Skip to content
This repository has been archived by the owner on Mar 5, 2022. It is now read-only.

Commit

Permalink
Fixing a minor issue in the getImageSize() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Krämer committed Aug 12, 2015
1 parent 42f257e commit c0c64c1
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions src/Lib/ImageProcessor.php
Expand Up @@ -410,22 +410,32 @@ public function resize($Image, array $options = []) {
* @see Imagine\Image\ImageInterface::getSize()
*/
public function getImageSize($Image = null) {
$Image = $this->_getImage($Image);
$BoxInterface = $Image->getSize($Image);
return [
$BoxInterface->getWidth(),
$BoxInterface->getHeight(),
'x' => $BoxInterface->getWidth(),
'y' => $BoxInterface->getHeight()
];
}

/**
* Gets an image from a file string or returns the image object that is
* loaded in the ImageProcessor::_image property.
*
* @param string|null $Image
* @return \Imagine\Image\
*/
protected function _getImage($Image = null) {
if (is_string($Image)) {
$class = 'Imagine\\' . $this->config('engine') . '\Imagine';
$Imagine = new $class();
$Image = $Imagine->open($Image);
return $Imagine->open($Image);
}
if (!empty($this->_image)) {
$Image = $this->_image;
return $this->_image;
}

$BoxInterface = $Image->getSize($Image);

return array(
$BoxInterface->getWidth(),
$BoxInterface->getHeight(),
'x' => $BoxInterface->getWidth(),
'y' => $BoxInterface->getHeight()
);
throw new \RuntimeException('Could not get the image object!');
}
}

0 comments on commit c0c64c1

Please sign in to comment.