Make WordPress Core

Ticket #33417: 33417.patch

File 33417.patch, 973 bytes (added by tyxla, 10 years ago)

Customizer Site Icon: SiteIconControl.setImageFromAttachment() - properly handling smaller image sizes when cropping step is skipped.

  • src/wp-admin/js/customize-controls.js

     
    21442144                 * @param {object} attachment
    21452145                 */
    21462146                setImageFromAttachment: function( attachment ) {
    2147                         var icon = typeof attachment.sizes['site_icon-32'] !== 'undefined' ? attachment.sizes['site_icon-32'] : attachment.sizes.thumbnail;
     2147                        var sizes = [ 'site_icon-32', 'thumbnail', 'full' ],
     2148                                icon;
    21482149
     2150                        _.each( sizes, function( size ) {
     2151                                if ( ! icon && ! _.isUndefined ( attachment.sizes[ size ] ) ) {
     2152                                        icon = attachment.sizes[ size ];
     2153                                }
     2154                        } );
     2155
    21492156                        this.params.attachment = attachment;
    21502157
    21512158                        // Set the Customizer setting; the callback takes care of rendering.
    21522159                        this.setting( attachment.id );
    21532160
    2154 
    21552161                        // Update the icon in-browser.
    21562162                        $( 'link[sizes="32x32"]' ).attr( 'href', icon.url );
    21572163                },