Skip to content

Commit

Permalink
fix: fix regression where crops with the default crop setting would s… (
Browse files Browse the repository at this point in the history
#2998)

* fix: fix regression where crops with the default crop setting would squeeze the image inside dimensions instead of cropping.
* fix: Solution for precision warning during image crops and Imagick active
  • Loading branch information
Levdbas committed May 15, 2024
1 parent dd34720 commit 8090247
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Image/Operation/Resize.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ protected function get_target_sizes(WP_Image_Editor $image)
$w = \round($h * $src_ratio);
}

if (!$crop || $crop === 'default') {
if (!$crop) {
return [
'x' => 0,
'y' => 0,
Expand Down Expand Up @@ -210,12 +210,12 @@ public function run($load_filename, $save_filename)

$crop = $this->get_target_sizes($image);
$image->crop(
$crop['x'],
$crop['y'],
$crop['src_w'],
$crop['src_h'],
$crop['target_w'],
$crop['target_h']
(int) $crop['x'],
(int) $crop['y'],
(int) $crop['src_w'],
(int) $crop['src_h'],
(int) $crop['target_w'],
(int) $crop['target_h']
);
$quality = \apply_filters('wp_editor_set_quality', 82, 'image/jpeg');
$image->set_quality($quality);
Expand Down

0 comments on commit 8090247

Please sign in to comment.