[wp-trac] [WordPress Trac] #16203: Modifications of media doesn't generate alternatives added by add_image_size()
WordPress Trac
wp-trac at lists.automattic.com
Tue Oct 25 16:39:55 UTC 2011
#16203: Modifications of media doesn't generate alternatives added by
add_image_size()
----------------------------+------------------------------
Reporter: andreaswedberg | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: 3.0.4
Severity: normal | Resolution:
Keywords: add_image_size |
----------------------------+------------------------------
Comment (by aut0poietic):
Just to add more information here: `add_image_size()` only temporarily
adds the image size to the `$_wp_additional_image_sizes` array ( in `wp-
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 of `wp-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()`.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16203#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list