← All changes
|
jetpack_vendor/automattic/jetpack-image-cdn/src/class-image-cdn.php
+7
-3
16.2
→
16.3
View file →
| @@ -11,9 +11,9 @@ | ||
| 11 | 11 | * Class Image_CDN |
| 12 | 12 | */ |
| 13 | 13 | final class Image_CDN { |
| 14 | 14 | |
| 15 | - const PACKAGE_VERSION = '0.8.0'; | |
| 15 | + const PACKAGE_VERSION = '0.8.1'; | |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * Singleton. |
| 19 | 19 | * |
| @@ -843,9 +843,13 @@ | ||
| 843 | 843 | $image_meta = wp_get_attachment_metadata( $attachment_id ); |
| 844 | 844 | |
| 845 | 845 | if ( isset( $image_meta['width'] ) && isset( $image_meta['height'] ) ) { |
| 846 | 846 | $image_resized = image_resize_dimensions( $image_meta['width'], $image_meta['height'], $image_args['width'], $image_args['height'], $image_args['crop'] ); |
| 847 | - if ( $image_resized ) { // This could be false when the requested image size is larger than the full-size image. | |
| 847 | + if ( | |
| 848 | + $image_resized // This could be false when the requested image size is larger than the full-size image. | |
| 849 | + && isset( $image_resized[6] ) // This key can be manipulated by the `image_resize_dimensions` filter | |
| 850 | + && isset( $image_resized[7] ) // This key can be manipulated by the `image_resize_dimensions` filter | |
| 851 | + ) { | |
| 848 | 852 | $image_meta['width'] = $image_resized[6]; |
| 849 | 853 | $image_meta['height'] = $image_resized[7]; |
| 850 | 854 | } |
| 851 | 855 | } |
| @@ -1085,9 +1089,9 @@ | ||
| 1085 | 1089 | $newsources = null; |
| 1086 | 1090 | |
| 1087 | 1091 | foreach ( $multipliers as $multiplier ) { |
| 1088 | 1092 | |
| 1089 | - $newwidth = $base * $multiplier; | |
| 1093 | + $newwidth = (int) round( $base * $multiplier ); | |
| 1090 | 1094 | foreach ( $currentwidths as $currentwidth ) { |
| 1091 | 1095 | // If a new width would be within 100 pixes of an existing one or larger than the full size image, skip. |
| 1092 | 1096 | if ( abs( $currentwidth - $newwidth ) < 50 || ( $newwidth > $fullwidth ) ) { |
| 1093 | 1097 | continue 2; // Bump out back to the $multipliers as $multiplier. |