WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/22/2015 02:29:57 AM (6 years ago)
Author:
obenland
Message:

Site Icon: Create custom sizes for images that don't need cropping.

This will duplicate an image that doesn't need cropping once and will skip
creating new images and custom sizes if the selected image has the site-icon
context.

Fixes #33011.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r33325 r33356  
    30813081            global $wp_site_icon;
    30823082
     3083            // Skip creating a new attachment if the attachment is a Site Icon.
     3084            if ( get_post_meta( $attachment_id, '_wp_attachment_context', true ) == $context ) {
     3085
     3086                // Delete the temporary cropped file, we don't need it.
     3087                wp_delete_file( $cropped );
     3088
     3089                // Additional sizes in wp_prepare_attachment_for_js().
     3090                add_filter( 'image_size_names_choose', array( $wp_site_icon, 'additional_sizes' ) );
     3091                break;
     3092            }
     3093
    30833094            /** This filter is documented in wp-admin/custom-header.php */
    30843095            $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication.
Note: See TracChangeset for help on using the changeset viewer.