[wp-trac] [WordPress Trac] #23860: Custom images sizes not cropped along with default WP image sizes
WordPress Trac
noreply at wordpress.org
Mon Mar 25 13:11:21 UTC 2013
#23860: Custom images sizes not cropped along with default WP image sizes
------------------------------------+--------------------------
Reporter: tolgapaksoy | Type: defect (bug)
Status: new | Priority: normal
Milestone: Awaiting Review | Component: Gallery
Version: 3.5.1 | Severity: normal
Keywords: dev-feedback has-patch |
------------------------------------+--------------------------
As of now, when you crop an image in the media page, it doesn't include
the custom images sizes. It only crops the full, thumbnail and large
variant.
The reason for this is the next line of code in `wp-admin/includes/image-
edit.php`:
{{{$_sizes[ $size ] = array( 'width' => get_option("{$size}_size_w"),
'height' => get_option("{$size}_size_h"), 'crop' => $crop );}}}
It assumes the custom image size properties are also defined in the
`wp_options` table, which they are not.
This is fixed by replacing line 691 and 692 in the `image-edit.php` with
these lines:
{{{
$crop = $nocrop ? false : get_option("{$size}_crop");
$size_w = get_option( "{$size}_size_w" );
$size_h = get_option( "{$size}_size_h" );
// No image size metadata found in options table. Force sizes from global
images sizes variable
if( ! $crop && ! $size_w && ! $size_h ) {
global $_wp_additional_image_sizes;
$crop = $nocrop ? false : $_wp_additional_image_sizes[ $size
]['crop'];
$size_w = $_wp_additional_image_sizes[ $size ]['width'];
$size_h = $_wp_additional_image_sizes[ $size ]['height'];
}
}}}
Is this normal, or do I have to also manually add the options into the
table? If so, why is this not handled in the `add_images_sizes()`
function?
--
Ticket URL: <http://core.trac.wordpress.org/ticket/23860>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list