#16203 closed defect (bug) (duplicate)
Modifications of media doesn't generate alternatives added by add_image_size()
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 3.0.4 |
| Component: | Media | Keywords: | |
| Focuses: | Cc: |
Description
Upload an image, then select "Edit Image".
Crop the image and Save.
Images with sizes added eith add_image_size() doesn't get alternatives generated as the standard sizes does.
Change History (3)
Note: See
TracTickets for help on using
tickets.
Just to add more information here:
add_image_size()only temporarily adds the image size to the$_wp_additional_image_sizesarray ( inwp-includes/media.php).The admin panel does not use this array, and instead uses the options
"{$size}_crop","{$size}_size_w"and"{$size}_size_h"( line 633 & 644 ofwp-admin/includes/image-edit.php). If those options don't exist, the theme/plugin added image size will not be updated.I've worked around the issue by calling add_option() for these option names at the same time I add the image size:
if ( function_exists( 'add_theme_support' ) ) { add_theme_support( 'post-thumbnails' ) ; add_image_size( 'my-custom-thumb', 478, 478, true ); // add_image_size() edit patch add_option( 'my-custom-thumb_crop' , true , '' , 'yes' ) ; add_option( 'my-custom-thumb_size_w' , 478 , '' , 'yes' ) ; add_option( 'my-custom-thumb_size_h' , 478 , '' , 'yes' ) ; }I'm not sure what the repercussions would be if similar code was added to
add_image_size().