mirror of
https://github.com/mosbth/cimage.git
synced 2025-08-04 23:27:43 +02:00
changing error handling to dir when failing to open a corrupt image
This commit is contained in:
12
CImage.php
12
CImage.php
@@ -808,15 +808,15 @@ class CImage
|
|||||||
switch ($this->fileExtension) {
|
switch ($this->fileExtension) {
|
||||||
case 'jpg':
|
case 'jpg':
|
||||||
case 'jpeg':
|
case 'jpeg':
|
||||||
$this->image = @imagecreatefromjpeg($this->pathToImage);
|
$this->image = imagecreatefromjpeg($this->pathToImage);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'gif':
|
case 'gif':
|
||||||
$this->image = @imagecreatefromgif($this->pathToImage);
|
$this->image = imagecreatefromgif($this->pathToImage);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'png':
|
case 'png':
|
||||||
$this->image = @imagecreatefrompng($this->pathToImage);
|
$this->image = imagecreatefrompng($this->pathToImage);
|
||||||
$type = $this->getPngType();
|
$type = $this->getPngType();
|
||||||
$hasFewColors = imagecolorstotal($this->image);
|
$hasFewColors = imagecolorstotal($this->image);
|
||||||
|
|
||||||
@@ -1241,7 +1241,7 @@ class CImage
|
|||||||
*
|
*
|
||||||
* @return $this or false if no folder is set.
|
* @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)) {
|
if (isset($src)) {
|
||||||
$this->setTarget($src, $base);
|
$this->setTarget($src, $base);
|
||||||
@@ -1249,8 +1249,8 @@ class CImage
|
|||||||
|
|
||||||
switch($this->extension) {
|
switch($this->extension) {
|
||||||
|
|
||||||
case 'jpeg':
|
case 'jpeg':
|
||||||
case 'jpg':
|
case 'jpg':
|
||||||
$this->Log("Saving image as JPEG to cache using quality = {$this->quality}.");
|
$this->Log("Saving image as JPEG to cache using quality = {$this->quality}.");
|
||||||
imagejpeg($this->image, $this->cacheFileName, $this->quality);
|
imagejpeg($this->image, $this->cacheFileName, $this->quality);
|
||||||
|
|
||||||
|
1
cache/README.md
vendored
1
cache/README.md
vendored
@@ -1 +0,0 @@
|
|||||||
This directory must be writable by the webserver.
|
|
@@ -103,6 +103,6 @@ return array(
|
|||||||
ini_set('display_errors', 1); // Display all errors
|
ini_set('display_errors', 1); // Display all errors
|
||||||
ini_set('output_buffering', 0); // Do not buffer outputs, write directly
|
ini_set('output_buffering', 0); // Do not buffer outputs, write directly
|
||||||
set_time_limit(20);
|
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
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user