After [45538]: fix a WPCS fix and make couple of var names consistent.
See #40439. git-svn-id: https://develop.svn.wordpress.org/trunk@45539 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ca84ae5030
commit
cd86b07108
@ -87,7 +87,7 @@ function wp_get_missing_image_subsizes( $attachment_id ) {
|
|||||||
|
|
||||||
// Meta error?
|
// Meta error?
|
||||||
if ( empty( $image_meta ) ) {
|
if ( empty( $image_meta ) ) {
|
||||||
return $defined_sizes;
|
return $registered_sizes;
|
||||||
}
|
}
|
||||||
|
|
||||||
$full_width = (int) $image_meta['width'];
|
$full_width = (int) $image_meta['width'];
|
||||||
@ -379,8 +379,8 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) {
|
|||||||
*/
|
*/
|
||||||
$fallback_sizes = apply_filters( 'fallback_intermediate_image_sizes', $fallback_sizes, $metadata );
|
$fallback_sizes = apply_filters( 'fallback_intermediate_image_sizes', $fallback_sizes, $metadata );
|
||||||
|
|
||||||
$defined_sizes = wp_get_registered_image_subsizes();
|
$registered_sizes = wp_get_registered_image_subsizes();
|
||||||
$merged_sizes = array_intersect_key( $defined_sizes, array_flip( $fallback_sizes ) );
|
$merged_sizes = array_intersect_key( $registered_sizes, array_flip( $fallback_sizes ) );
|
||||||
|
|
||||||
// Force thumbnails to be soft crops.
|
// Force thumbnails to be soft crops.
|
||||||
if ( isset( $merged_sizes['thumbnail'] ) && is_array( $merged_sizes['thumbnail'] ) ) {
|
if ( isset( $merged_sizes['thumbnail'] ) && is_array( $merged_sizes['thumbnail'] ) ) {
|
||||||
|
@ -235,7 +235,11 @@ function image_downsize( $id, $size = 'medium' ) {
|
|||||||
} elseif ( $size === 'thumbnail' ) {
|
} elseif ( $size === 'thumbnail' ) {
|
||||||
// fall back to the old thumbnail
|
// fall back to the old thumbnail
|
||||||
$thumb_file = wp_get_attachment_thumb_file( $id );
|
$thumb_file = wp_get_attachment_thumb_file( $id );
|
||||||
$info = getimagesize( $thumb_file );
|
$info = null;
|
||||||
|
|
||||||
|
if ( $thumb_file ) {
|
||||||
|
$info = getimagesize( $thumb_file );
|
||||||
|
}
|
||||||
|
|
||||||
if ( $thumb_file && $info ) {
|
if ( $thumb_file && $info ) {
|
||||||
$img_url = str_replace( $img_url_basename, wp_basename( $thumb_file ), $img_url );
|
$img_url = str_replace( $img_url_basename, wp_basename( $thumb_file ), $img_url );
|
||||||
|
Loading…
Reference in New Issue
Block a user