1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-08-13 03:24:16 +02:00

Verbose error when failing to open image

This commit is contained in:
Mikael Roos
2014-08-21 02:08:49 +02:00
parent 28cda0ea28
commit ef1d56085a
2 changed files with 5 additions and 0 deletions

View File

@@ -809,14 +809,18 @@ class CImage
case 'jpg':
case 'jpeg':
$this->image = imagecreatefromjpeg($this->pathToImage);
$this->image or die("Fatal error when opening image.");
break;
case 'gif':
$this->image = imagecreatefromgif($this->pathToImage);
$this->image or die("Fatal error when opening image.");
break;
case 'png':
$this->image = imagecreatefrompng($this->pathToImage);
$this->image or die("Fatal error when opening image.");
$type = $this->getPngType();
$hasFewColors = imagecolorstotal($this->image);