1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-01-17 19:18:15 +01: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);

View File

@ -133,6 +133,7 @@ Revision history
v0.5.x (latest)
* Removed @ from opening images, better to display correct warning when failing #34.
* Setting gd.jpeg_ignore_warning to true as default #34.
* `webroot/check_system.php` now outputs version of PHP and GD.
* #32 correctly send 404 header when serving an error message.