Skip to content

Commit

Permalink
Fixed image resize if zoom is allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
roadster31 committed Jun 28, 2017
1 parent c8530e7 commit 0a83bde
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions core/lib/Thelia/Action/Image.php
Expand Up @@ -301,11 +301,18 @@ protected function applyResize(
$delta_x = $delta_y = $border_width = $border_height = 0;

if ($width_diff > 1 && $height_diff > 1) {
$resize_width = $width_orig;
$resize_height = $height_orig;
// Set the default final size. If zoom is allowed, we will get the required
// image dimension. Otherwise, the final image may be smaller than required.
if ($allow_zoom) {
$resize_width = $dest_width;
$resize_height = $dest_height;
} else {
$resize_width = $width_orig;
$resize_height = $height_orig;
}

// When cropping, be sure to always generate an image which is
// no smaller than the required size, zooming it if required.
// not smaller than the required size, zooming it if required.
if ($resize_mode == self::EXACT_RATIO_WITH_CROP) {
if ($allow_zoom) {
if ($width_diff > $height_diff) {
Expand Down

0 comments on commit 0a83bde

Please sign in to comment.