Changeset 33356
- Timestamp:
- 07/22/2015 02:29:57 AM (10 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ajax-actions.php
r33325 r33356 3081 3081 global $wp_site_icon; 3082 3082 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 3083 3094 /** This filter is documented in wp-admin/custom-header.php */ 3084 3095 $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication. -
trunk/src/wp-admin/js/customize-controls.js
r33333 r33356 2077 2077 2078 2078 /** 2079 * After an image is selected in the media modal, switch to the cropper 2080 * state if the image isn't the right size. 2081 */ 2082 onSelect: function() { 2083 var attachment = this.frame.state().get( 'selection' ).first().toJSON(), 2084 controller = this; 2085 2086 if ( this.params.width === attachment.width && this.params.height === attachment.height && ! this.params.flex_width && ! this.params.flex_height ) { 2087 wp.ajax.post( 'crop-image', { 2088 nonce: attachment.nonces.edit, 2089 id: attachment.id, 2090 context: 'site-icon', 2091 cropDetails: { 2092 x1: 0, 2093 y1: 0, 2094 width: this.params.width, 2095 height: this.params.height, 2096 dst_width: this.params.width, 2097 dst_height: this.params.height 2098 } 2099 } ).done( function( croppedImage ) { 2100 controller.setImageFromAttachment( croppedImage ); 2101 controller.frame.close(); 2102 } ).fail( function() { 2103 controller.trigger('content:error:crop'); 2104 } ); 2105 } else { 2106 this.frame.setState( 'cropper' ); 2107 } 2108 }, 2109 2110 /** 2079 2111 * Updates the setting and re-renders the control UI. 2080 2112 * … … 2091 2123 2092 2124 // Update the icon in-browser. 2093 $( 'link[ rel="icon"]' ).attr( 'href', icon.url );2125 $( 'link[sizes="32x32"]' ).attr( 'href', icon.url ); 2094 2126 }, 2095 2127
Note: See TracChangeset
for help on using the changeset viewer.