- Deprecate `wp_get_attachment_thumb_file()`.
- Make `wp_get_attachment_thumb_url()` an alias of `wp_get_attachment_image_url()`. This fixes it to return the proper thumbnail URL and fall back to returning the URL to `image_meta['thumb']` if only that exists.

Props: markhowellsmead, mukesh27, csesumonpro, SergeyBiryukov, mikeschroder, killua99, joemcgill, mashukushibiki, mfgmicha, swissspidy, romulodl, nacin, JoshuaAbenazer, wonderboymusic, lonnylot, azaozz.
Built from https://develop.svn.wordpress.org/trunk@53685


git-svn-id: http://core.svn.wordpress.org/trunk@53244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz
2022-07-07 23:32:11 +00:00
parent b8b2693bdb
commit 8091de83b5
4 changed files with 70 additions and 74 deletions

View File

@@ -238,20 +238,20 @@ function image_downsize( $id, $size = 'medium' ) {
$width = $intermediate['width'];
$height = $intermediate['height'];
$is_intermediate = true;
} elseif ( 'thumbnail' === $size ) {
} elseif ( 'thumbnail' === $size && ! empty( $meta['thumb'] ) && is_string( $meta['thumb'] ) ) {
// Fall back to the old thumbnail.
$thumb_file = wp_get_attachment_thumb_file( $id );
$info = null;
$imagefile = get_attached_file( $id );
$thumbfile = str_replace( wp_basename( $imagefile ), wp_basename( $meta['thumb'] ), $imagefile );
if ( $thumb_file ) {
$info = wp_getimagesize( $thumb_file );
}
if ( file_exists( $thumbfile ) ) {
$info = wp_getimagesize( $thumbfile );
if ( $thumb_file && $info ) {
$img_url = str_replace( $img_url_basename, wp_basename( $thumb_file ), $img_url );
$width = $info[0];
$height = $info[1];
$is_intermediate = true;
if ( $info ) {
$img_url = str_replace( $img_url_basename, wp_basename( $thumbfile ), $img_url );
$width = $info[0];
$height = $info[1];
$is_intermediate = true;
}
}
}