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. git-svn-id: https://develop.svn.wordpress.org/trunk@34056 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f30a1c86b1
commit
9805723e3d
@ -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 );
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user