| @@ -17,8 +17,36 @@ | ||
| 17 | 17 | */ |
| 18 | 18 | class WP extends AbstractProcess { |
| 19 | 19 | |
| 20 | 20 | /** ----------------------------------------------------------------------------------------- */ |
| 21 | + /** RESIZING ================================================================================ */ | |
| 22 | + /** ----------------------------------------------------------------------------------------- */ | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * Tell if a size should be resized. | |
| 26 | + * | |
| 27 | + * When the browser handled the upload it also produced the scaled version, using the | |
| 28 | + * very threshold Imagify configured ({@see \Imagify\Context\WP::filter_big_image_size_threshold()}), | |
| 29 | + * so resizing here would only shrink the untouched original that WordPress keeps | |
| 30 | + * aside as `original_image`. | |
| 31 | + * | |
| 32 | + * @since 2.3.3 | |
| 33 | + * | |
| 34 | + * @param string $size The size name. | |
| 35 | + * @param File $file A File instance. | |
| 36 | + * @return bool | |
| 37 | + */ | |
| 38 | + protected function can_resize( $size, $file ) { | |
| 39 | + $media = $this->get_media(); | |
| 40 | + | |
| 41 | + if ( $media && \Imagify\Context\WP::is_client_side_scaled( $media->get_id() ) ) { | |
| 42 | + return false; | |
| 43 | + } | |
| 44 | + | |
| 45 | + return parent::can_resize( $size, $file ); | |
| 46 | + } | |
| 47 | + | |
| 48 | + /** ----------------------------------------------------------------------------------------- */ | |
| 21 | 49 | /** MISSING THUMBNAILS ====================================================================== */ |
| 22 | 50 | /** ----------------------------------------------------------------------------------------- */ |
| 23 | 51 | |
| 24 | 52 | /** |