[wp-trac] [WordPress Trac] #19889: Image Editor doesn't apply changes to custom image sizes

WordPress Trac wp-trac at lists.automattic.com
Tue Jan 24 19:48:53 UTC 2012


#19889: Image Editor doesn't apply changes to custom image sizes
--------------------------+-----------------------------
 Reporter:  Otto42        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  3.3.1
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 The built in image editor doesn't apply changes like cropping, rotation,
 etc. to image sizes added using add_image_size or similar methods.

 This is because the code in image-edit.php is directly looking for the
 image sizes in the options table, which only valid for the built-in sizes,
 not for custom image sizes.

 Specifically, in the wp_save_image function in image-edit.php, this code
 is incorrect:

 {{{
 $crop = $nocrop ? false : get_option("{$size}_crop");
 $resized = image_make_intermediate_size($new_path,
 get_option("{$size}_size_w"), get_option("{$size}_size_h"), $crop );
 }}}

 The fix to this is to make the wp_save_image function aware of custom
 sizes in the $_wp_additional_image_sizes global, and to use the options
 data as a fallback (for the built in sizes).

 Patch for trunk attached. Tested on trunk install with no obvious side
 effects. Patched version correctly creates the custom image sizes with the
 applied editing changes, and deletes them properly when the image is
 deleted in the admin. Meta data thus created looks correct as well.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19889>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list