Media: Avoid a PHP notice in `image_downsize()` when trying to replace a non-image URL with a rendered image from its meta.

Props Mte90, jrf, hareesh-pillai.
Fixes #48324.

git-svn-id: https://develop.svn.wordpress.org/trunk@46772 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-11-25 10:05:39 +00:00
parent dc486308e6
commit 7dfb911b7b
1 changed files with 1 additions and 1 deletions

View File

@ -220,7 +220,7 @@ function image_downsize( $id, $size = 'medium' ) {
// If the file isn't an image, attempt to replace its URL with a rendered image from its meta. // If the file isn't an image, attempt to replace its URL with a rendered image from its meta.
// Otherwise, a non-image type could be returned. // Otherwise, a non-image type could be returned.
if ( ! $is_image ) { if ( ! $is_image ) {
if ( ! empty( $meta['sizes'] ) ) { if ( ! empty( $meta['sizes']['full'] ) ) {
$img_url = str_replace( $img_url_basename, $meta['sizes']['full']['file'], $img_url ); $img_url = str_replace( $img_url_basename, $meta['sizes']['full']['file'], $img_url );
$img_url_basename = $meta['sizes']['full']['file']; $img_url_basename = $meta['sizes']['full']['file'];
$width = $meta['sizes']['full']['width']; $width = $meta['sizes']['full']['width'];