Skip to content

Commit f7d12bc

Browse files
Fix PHP warnings for non-resizable images by adding fallback dimensions
1 parent 9565bce commit f7d12bc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/wp-admin/includes/image.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,14 @@ function wp_get_missing_image_subsizes( $attachment_id ) {
103103
$imagesize = wp_getimagesize( $image_file );
104104
}
105105

106+
// Fallback to the "full" size dimensions.
107+
$full_width = 0;
108+
$full_height = 0;
109+
106110
if ( ! empty( $imagesize ) ) {
107111
$full_width = $imagesize[0];
108112
$full_height = $imagesize[1];
109-
} else {
113+
} elseif ( ! empty( $image_meta['width'] ) && ! empty( $image_meta['height'] ) ) {
110114
$full_width = (int) $image_meta['width'];
111115
$full_height = (int) $image_meta['height'];
112116
}

0 commit comments

Comments
 (0)