Changeset 33280
- Timestamp:
- 07/15/2015 07:53:23 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ajax-actions.php
r33257 r33280 3096 3096 3097 3097 /** 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 * @param int $attachment_id The attachment ID of the original image. 3106 * @param string $cropped Path to the cropped image file. 3107 */ 3108 do_action( 'wp_ajax_crop_image_pre_save', $context, $attachment_id, $cropped ); 3109 3110 /** This filter is documented in wp-admin/custom-header.php */ 3111 $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication. 3112 3113 $parent_url = get_post( $attachment_id )->guid; 3114 $url = str_replace( basename( $parent_url ), basename( $cropped ), $parent_url ); 3115 3116 $size = @getimagesize( $cropped ); 3117 $image_type = ( $size ) ? $size['mime'] : 'image/jpeg'; 3118 3119 $object = array( 3120 'post_title' => basename( $cropped ), 3121 'post_content' => $url, 3122 'post_mime_type' => $image_type, 3123 'guid' => $url, 3124 'context' => $context, 3125 ); 3126 3127 $attachment_id = wp_insert_attachment( $object, $cropped ); 3128 $metadata = wp_generate_attachment_metadata( $attachment_id, $cropped ); 3129 3130 /** 3131 * Filter the cropped image attachment metadata. 3132 * 3133 * @since 4.3.0 3134 * 3135 * @see wp_generate_attachment_metadata() 3136 * 3137 * @param array $metadata Attachment metadata. 3138 */ 3139 $metadata = apply_filters( 'wp_ajax_cropped_attachment_metadata', $metadata ); 3140 wp_update_attachment_metadata( $attachment_id, $metadata ); 3141 3142 /** 3098 3143 * Filter the attachment ID for a cropped image. 3099 3144 * 3100 3145 * @since 4.3.0 3101 3146 * 3102 * @param int $attachment_id The ID of the cropped image.3103 * @param string $context The featurerequesting the cropped image.3147 * @param int $attachment_id The attachment ID of the cropped image. 3148 * @param string $context The Customizer control requesting the cropped image. 3104 3149 */ 3105 $attachment_id = apply_filters( 'wp_ajax_cropped_attachment_id', 0, $context ); 3106 3107 if ( ! $attachment_id ) { 3108 wp_send_json_error(); 3109 } 3150 $attachment_id = apply_filters( 'wp_ajax_cropped_attachment_id', $attachment_id, $context ); 3110 3151 } 3111 3152 -
trunk/src/wp-includes/class-wp-customize-control.php
r33216 r33280 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 /** -
trunk/src/wp-includes/script-loader.php
r33249 r33280 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(
Note: See TracChangeset
for help on using the changeset viewer.