From cb2df7b6a2b3c3adc40eccbd0f042a5ab94fcd74 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Thu, 12 Jun 2014 14:28:05 +0300 Subject: [PATCH] fix image resize --- application/Espo/EntryPoints/Image.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/application/Espo/EntryPoints/Image.php b/application/Espo/EntryPoints/Image.php index bd36bb7374..81f51acb7b 100644 --- a/application/Espo/EntryPoints/Image.php +++ b/application/Espo/EntryPoints/Image.php @@ -145,16 +145,17 @@ class Image extends \Espo\Core\EntryPoints\Base list($originalWidth, $originalHeight) = getimagesize($filePath); list($width, $height) = $this->imageSizes[$size]; - if ($originalWidth > $width && ($originalHeight <= $height || $originalWidth > $originalHeight)) { + if ($originalWidth > $width && ($originalHeight <= $height || $originalWidth < $originalHeight)) { $targetWidth = $width; $targetHeight = $originalHeight * ($width / $originalWidth); - } else if ($originalHeight > $height && ($originalWidth <= $width || $originalHeight > $originalWidth)) { + } else if ($originalHeight > $height && ($originalWidth <= $width || $originalHeight < $originalWidth)) { $targetHeight = $height; $targetWidth = $originalWidth * ($height / $originalHeight); } else { $targetWidth = $originalWidth; $targetHeight = $originalHeight; } + $targetImage = imagecreatetruecolor($targetWidth, $targetHeight); switch ($fileType) {