From da103bda608fe82daac40b7ba2e6757a5df10a68 Mon Sep 17 00:00:00 2001 From: Jignesh Nakrani Date: Tue, 30 Sep 2025 20:16:09 +0530 Subject: [PATCH] Fix PHP warnings for non-resizable images by adding fallback dimensions --- src/wp-admin/includes/image.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/includes/image.php b/src/wp-admin/includes/image.php index 1b5f2b11263ce..3c88446c27974 100644 --- a/src/wp-admin/includes/image.php +++ b/src/wp-admin/includes/image.php @@ -103,10 +103,14 @@ function wp_get_missing_image_subsizes( $attachment_id ) { $imagesize = wp_getimagesize( $image_file ); } + // Fallback to the "full" size dimensions. + $full_width = 0; + $full_height = 0; + if ( ! empty( $imagesize ) ) { $full_width = $imagesize[0]; $full_height = $imagesize[1]; - } else { + } elseif ( ! empty( $image_meta['width'] ) && ! empty( $image_meta['height'] ) ) { $full_width = (int) $image_meta['width']; $full_height = (int) $image_meta['height']; }