Site Icon: For preview fall back to full size URL when thumbnail size doesn't exist.

Prevents a JavaScript error for rare cases when cropping is skipped and the image is smaller than `thumbnail`.

Props tyxla.
Fixes #33417.
Built from https://develop.svn.wordpress.org/trunk@34056


git-svn-id: http://core.svn.wordpress.org/trunk@34024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2015-09-11 20:13:25 +00:00
parent 09b159e494
commit d6f26e4c7c
3 changed files with 11 additions and 5 deletions

View File

@ -2182,14 +2182,20 @@
* @param {object} attachment
*/
setImageFromAttachment: function( attachment ) {
var icon = typeof attachment.sizes['site_icon-32'] !== 'undefined' ? attachment.sizes['site_icon-32'] : attachment.sizes.thumbnail;
var sizes = [ 'site_icon-32', 'thumbnail', 'full' ],
icon;
_.each( sizes, function( size ) {
if ( ! icon && ! _.isUndefined ( attachment.sizes[ size ] ) ) {
icon = attachment.sizes[ size ];
}
} );
this.params.attachment = attachment;
// Set the Customizer setting; the callback takes care of rendering.
this.setting( attachment.id );
// Update the icon in-browser.
$( 'link[sizes="32x32"]' ).attr( 'href', icon.url );
},

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34054';
$wp_version = '4.4-alpha-34056';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.