From fd60134769a92a95926bf8f424258baaa42e5cbe Mon Sep 17 00:00:00 2001 From: Costa Date: Mon, 27 Oct 2014 18:14:55 +0300 Subject: [PATCH] getSizes method --- models/Image.php | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/models/Image.php b/models/Image.php index ef833ef..1c86ed9 100755 --- a/models/Image.php +++ b/models/Image.php @@ -93,13 +93,10 @@ public function getPathToOrigin(){ return $filePath; } - public function getSizesWhen($sizeString){ - - $size = $this->getModule()->parseSize($sizeString); - if(!$size){ - throw new \Exception('Bad size..'); - } + public function getSizes() + { + $sizes = false; if($this->getModule()->graphicsLibrary == 'Imagick'){ $image = new \Imagick($this->getPathToOrigin()); $sizes = $image->getImageGeometry(); @@ -109,6 +106,19 @@ public function getSizesWhen($sizeString){ $sizes['height'] = $image->get_height(); } + return $sizes; + } + + public function getSizesWhen($sizeString){ + + $size = $this->getModule()->parseSize($sizeString); + if(!$size){ + throw new \Exception('Bad size..'); + } + + + + $sizes = $this->getSizes(); $imageWidth = $sizes['width']; $imageHeight = $sizes['height'];