Skip to content

Commit

Permalink
Ignore JPEG warnings; fixes #155
Browse files Browse the repository at this point in the history
  • Loading branch information
claviska committed Jan 6, 2017
1 parent 97f0c46 commit a9fc06b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/abeautifulsite/SimpleImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ class SimpleImage {
*
*/
function __construct($filename = null, $width = null, $height = null, $color = null) {
// Ignore JPEG warnings that cause imagecreatefromjpeg() to fail
ini_set('gd.jpeg_ignore_warning', 1);

if ($filename) {
$this->load($filename);
} elseif ($width) {
Expand Down Expand Up @@ -1235,9 +1238,10 @@ protected function get_meta_data() {
case 'image/png':
$this->image = imagecreatefrompng($this->filename);
break;
default:
throw new Exception('Invalid image: '.$this->filename);
break;
}

if(!$this->image) {
throw new Exception('Invalid or corrupt image: ' . $this->filename);
}
} elseif (function_exists('getimagesizefromstring')) {
$info = getimagesizefromstring($this->imagestring);
Expand Down

0 comments on commit a9fc06b

Please sign in to comment.