fix image resize

This commit is contained in:
Yuri Kuznetsov
2014-06-12 14:28:05 +03:00
parent f2a5474b4a
commit cb2df7b6a2
+3 -2
View File
@@ -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) {