Load an image from disk. This default implementation always gives a zero-sized image.
protected loadImageData ( string $filename = null ) | ||
$filename | string | Filename to load from. |
/** * Load an image from disk, into memory, using GD. * * @param string $filename The filename to load from * @throws Exception if the image format is not supported, * or the file cannot be opened. */ protected function loadImageData($filename = null) { if ($filename === null) { /* Set to blank image */ return parent::loadImageData($filename); } $ext = pathinfo($filename, PATHINFO_EXTENSION); switch ($ext) { case "png": $im = @imagecreatefrompng($filename); break; case "jpg": $im = @imagecreatefromjpeg($filename); break; case "gif": $im = @imagecreatefromgif($filename); break; default: throw new Exception("Image format not supported in GD"); } $this->readImageFromGdResource($im); }
/** * Load an image from disk, into memory, using Imagick. * * @param string $filename The filename to load from * @throws Exception if the image format is not supported, * or the file cannot be opened. */ protected function loadImageData($filename = null) { if ($filename === null) { /* Set to blank image */ return parent::loadImageData($filename); } $im = $im = $this->getImageFromFile($filename); $this->readImageFromImagick($im); }