WordPress.org

Make WordPress Core

Changeset 34056


Ignore:
Timestamp:
09/11/2015 08:12:50 PM (5 years ago)
Author:
ocean90
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/customize-controls.js

    r33939 r34056  
    21832183         */
    21842184        setImageFromAttachment: function( attachment ) {
    2185             var icon = typeof attachment.sizes['site_icon-32'] !== 'undefined' ? attachment.sizes['site_icon-32'] : attachment.sizes.thumbnail;
     2185            var sizes = [ 'site_icon-32', 'thumbnail', 'full' ],
     2186                icon;
     2187
     2188            _.each( sizes, function( size ) {
     2189                if ( ! icon && ! _.isUndefined ( attachment.sizes[ size ] ) ) {
     2190                    icon = attachment.sizes[ size ];
     2191                }
     2192            } );
    21862193
    21872194            this.params.attachment = attachment;
     
    21892196            // Set the Customizer setting; the callback takes care of rendering.
    21902197            this.setting( attachment.id );
    2191 
    21922198
    21932199            // Update the icon in-browser.
Note: See TracChangeset for help on using the changeset viewer.