From 28cda0ea280f951cac8fc6481b5e50ecdc524135 Mon Sep 17 00:00:00 2001 From: Mikael Roos Date: Thu, 21 Aug 2014 02:02:50 +0200 Subject: [PATCH] changing error handling to dir when failing to open a corrupt image --- CImage.php | 12 ++++++------ cache/README.md | 1 - webroot/img_config.php | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) delete mode 100644 cache/README.md diff --git a/CImage.php b/CImage.php index 1f7e839..003310e 100644 --- a/CImage.php +++ b/CImage.php @@ -808,15 +808,15 @@ class CImage switch ($this->fileExtension) { case 'jpg': case 'jpeg': - $this->image = @imagecreatefromjpeg($this->pathToImage); + $this->image = imagecreatefromjpeg($this->pathToImage); break; case 'gif': - $this->image = @imagecreatefromgif($this->pathToImage); + $this->image = imagecreatefromgif($this->pathToImage); break; case 'png': - $this->image = @imagecreatefrompng($this->pathToImage); + $this->image = imagecreatefrompng($this->pathToImage); $type = $this->getPngType(); $hasFewColors = imagecolorstotal($this->image); @@ -1241,7 +1241,7 @@ class CImage * * @return $this or false if no folder is set. */ - public function save($src = null, $base = null) + public function save($src = null, $base = null) { if (isset($src)) { $this->setTarget($src, $base); @@ -1249,8 +1249,8 @@ class CImage switch($this->extension) { - case 'jpeg': - case 'jpg': + case 'jpeg': + case 'jpg': $this->Log("Saving image as JPEG to cache using quality = {$this->quality}."); imagejpeg($this->image, $this->cacheFileName, $this->quality); diff --git a/cache/README.md b/cache/README.md deleted file mode 100644 index 928392a..0000000 --- a/cache/README.md +++ /dev/null @@ -1 +0,0 @@ -This directory must be writable by the webserver. diff --git a/webroot/img_config.php b/webroot/img_config.php index a6acfe5..2f0853e 100644 --- a/webroot/img_config.php +++ b/webroot/img_config.php @@ -103,6 +103,6 @@ return array( ini_set('display_errors', 1); // Display all errors ini_set('output_buffering', 0); // Do not buffer outputs, write directly set_time_limit(20); - ini_set('gd.jpeg_ignore_warning', 1); // Ignore warning of corrupt jpegs + ini_set('gd.jpeg_ignore_warning', 0); // Ignore warning of corrupt jpegs }, );