Media: Pass thumbnail and medium sizes to image_constrain_size_for_editor() to force constraints based on the current DB options for those sizes. History: see #22598, #22738.

props jond3r.
see #23102.
for trunk.



git-svn-id: http://core.svn.wordpress.org/trunk@23264 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-01-04 08:52:18 +00:00
parent a84cef4556
commit 2428b370a2

View File

@ -1391,13 +1391,8 @@ function wp_prepare_attachment_for_js( $attachment ) {
$size_meta = $meta['sizes'][ $size ];
// We have the actual image size, but might need to further constrain it if content_width is narrower.
// This is not necessary for thumbnails and medium size.
if ( 'thumbnail' == $size || 'medium' == $size ) {
$width = $size_meta['width'];
$height = $size_meta['height'];
} else {
list( $width, $height ) = image_constrain_size_for_editor( $size_meta['width'], $size_meta['height'], $size, 'edit' );
}
// Thumbnail, medium, and full sizes are also checked against the site's height/width options.
list( $width, $height ) = image_constrain_size_for_editor( $size_meta['width'], $size_meta['height'], $size, 'edit' );
$sizes[ $size ] = array(
'height' => $height,