From b31d51347b2983c84a57c0ef1af32b0be3e9780c Mon Sep 17 00:00:00 2001 From: Costa Date: Mon, 11 Aug 2014 12:26:27 +0400 Subject: [PATCH] fix size when method --- models/Image.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/models/Image.php b/models/Image.php index d0683c3..98e5f78 100755 --- a/models/Image.php +++ b/models/Image.php @@ -99,8 +99,17 @@ public function getSizesWhen($sizeString){ if(!$size){ throw new \Exception('Bad size..'); } - $image = new \Imagick($this->getPathToOrigin()); - $sizes = $image->getImageGeometry(); + + if($this->getModule()->graphicsLibrary == 'Imagick'){ + $image = new \Imagick($this->getPathToOrigin()); + $sizes = $image->getImageGeometry(); + }else{ + $image = new \abeautifulsite\SimpleImage($this->getPathToOrigin()); + $sizes['width'] = $image->get_width(); + $sizes['height'] = $image->get_height(); + } + + $imageWidth = $sizes['width']; $imageHeight = $sizes['height']; $newSizes = [];