From af03fd6870719bae1c4fb84f854f0647e2ef17e1 Mon Sep 17 00:00:00 2001 From: Edward Date: Thu, 4 Oct 2018 11:00:35 +0800 Subject: [PATCH] DataObjects/Images.php --- DataObjects/Images.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/DataObjects/Images.php b/DataObjects/Images.php index 84b39c02..4edf3480 100644 --- a/DataObjects/Images.php +++ b/DataObjects/Images.php @@ -833,14 +833,17 @@ class Pman_Core_DataObjects_Images extends DB_DataObject if($rotate){ $data = $this->rotate(); } - - if(!empty($scaleWidth) || !empty($scaleHeight)){ - - $width = $this->width; - $height = $this->height; - - + $width = $this->width; + $height = $this->height; + + if(!empty($scaleWidth)){ + $width = $scaleWidth; + + if(empty($scaleHeight)){ + $height = $this->height * $scaleWidth / $this->width; + } + } $base64 = 'data:' . $this->mimetype . ';base64,' . base64_encode($data); -- 2.39.2