/**
* 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);
}