Ticket #29211: 29211.6.diff
| File 29211.6.diff, 4.2 KB (added by , 11 years ago) |
|---|
-
src/wp-admin/includes/ajax-actions.php
3095 3095 default: 3096 3096 3097 3097 /** 3098 * Filter the attachment ID for a cropped image. 3098 * Fires before a cropped image is saved. 3099 * 3100 * Allows to add filters to modify the way a cropped image is saved. 3101 * 3102 * @since 4.3.0 3103 * 3104 * @param string $context The Customizer control requesting the cropped image. 3105 */ 3106 do_action( 'pre_wp_ajax_crop_image', $context ); 3107 3108 /** This filter is documented in wp-admin/custom-header.php */ 3109 $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication. 3110 3111 $parent_url = get_post( $attachment_id )->guid; 3112 $url = str_replace( basename( $parent_url ), basename( $cropped ), $parent_url ); 3113 3114 $size = @getimagesize( $cropped ); 3115 $image_type = ( $size ) ? $size['mime'] : 'image/jpeg'; 3116 3117 $object = array( 3118 'post_title' => basename( $cropped ), 3119 'post_content' => $url, 3120 'post_mime_type' => $image_type, 3121 'guid' => $url, 3122 'context' => $context, 3123 ); 3124 3125 $attachment_id = wp_insert_attachment( $object, $cropped ); 3126 $metadata = wp_generate_attachment_metadata( $attachment_id, $cropped ); 3127 3128 /** 3129 * Filter the cropped image attachment metadata. 3099 3130 * 3100 3131 * @since 4.3.0 3101 3132 * 3102 * @param int $attachment_id The ID of the cropped image. 3103 * @param string $context The feature requesting the cropped image. 3133 * @see wp_generate_attachment_metadata() 3134 * 3135 * @param array $metadata Attachment metadata. 3104 3136 */ 3105 $attachment_id = apply_filters( 'wp_ajax_cropped_attachment_id', 0, $context ); 3137 $metadata = apply_filters( 'wp_ajax_cropped_attachment_metadata', $metadata ); 3138 wp_update_attachment_metadata( $attachment_id, $metadata ); 3106 3139 3107 if ( ! $attachment_id ) { 3108 wp_send_json_error(); 3109 } 3140 /** 3141 * Filter the attachment ID for a cropped image. 3142 * 3143 * @since 4.3.0 3144 * 3145 * @param int $attachment_id The attachment ID of the cropped image. 3146 * @param string $context The Customizer control requesting the cropped image. 3147 */ 3148 $attachment_id = apply_filters( 'wp_ajax_cropped_attachment_id', $attachment_id, $context ); 3110 3149 } 3111 3150 3112 3151 wp_send_json_success( wp_prepare_attachment_for_js( $attachment_id ) ); -
src/wp-includes/class-wp-customize-control.php
1005 1005 * 1006 1006 * @since 4.3.0 1007 1007 * 1008 * @see WP_Customize_ Image_Control1008 * @see WP_Customize_Media_Control 1009 1009 */ 1010 class WP_Customize_Cropped_Image_Control extends WP_Customize_ Image_Control {1010 class WP_Customize_Cropped_Image_Control extends WP_Customize_Media_Control { 1011 1011 1012 1012 /** 1013 1013 * Control type. -
src/wp-includes/script-loader.php
410 410 $scripts->add( 'customize-loader', "/wp-includes/js/customize-loader$suffix.js", array( 'customize-base' ), false, 1 ); 411 411 $scripts->add( 'customize-preview', "/wp-includes/js/customize-preview$suffix.js", array( 'customize-base' ), false, 1 ); 412 412 $scripts->add( 'customize-models', "/wp-includes/js/customize-models.js", array( 'underscore', 'backbone' ), false, 1 ); 413 $scripts->add( 'customize-views', "/wp-includes/js/customize-views.js", array( 'jquery', 'underscore', 'imgareaselect', 'customize-models' ), false, 1 );413 $scripts->add( 'customize-views', "/wp-includes/js/customize-views.js", array( 'jquery', 'underscore', 'imgareaselect', 'customize-models', 'media-editor', 'media-views' ), false, 1 ); 414 414 $scripts->add( 'customize-controls', "/wp-admin/js/customize-controls$suffix.js", array( 'customize-base' ), false, 1 ); 415 415 did_action( 'init' ) && $scripts->localize( 'customize-controls', '_wpCustomizeControlsL10n', array( 416 416 'activate' => __( 'Save & Activate' ),