mirror of
https://github.com/mosbth/cimage.git
synced 2025-07-25 18:51:19 +02:00
improving error handling when opening (non)-recoverable images
This commit is contained in:
@@ -840,17 +840,17 @@ class CImage
|
|||||||
case 'jpg':
|
case 'jpg':
|
||||||
case 'jpeg':
|
case 'jpeg':
|
||||||
$this->image = @imagecreatefromjpeg($this->pathToImage);
|
$this->image = @imagecreatefromjpeg($this->pathToImage);
|
||||||
$this->image or failedToLoad();
|
$this->image or $this->failedToLoad();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'gif':
|
case 'gif':
|
||||||
$this->image = @imagecreatefromgif($this->pathToImage);
|
$this->image = @imagecreatefromgif($this->pathToImage);
|
||||||
$this->image or failedToLoad();
|
$this->image or $this->failedToLoad();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'png':
|
case 'png':
|
||||||
$this->image = @imagecreatefrompng($this->pathToImage);
|
$this->image = @imagecreatefrompng($this->pathToImage);
|
||||||
$this->image or failedToLoad();
|
$this->image or $this->failedToLoad();
|
||||||
|
|
||||||
$type = $this->getPngType();
|
$type = $this->getPngType();
|
||||||
$hasFewColors = imagecolorstotal($this->image);
|
$hasFewColors = imagecolorstotal($this->image);
|
||||||
|
Reference in New Issue
Block a user