Skip to content

Commit

Permalink
Merge pull request #11 from bobdenotter/master
Browse files Browse the repository at this point in the history
Added 'function_exists' for old GD versions.
  • Loading branch information
rarila committed Jan 8, 2015
2 parents 0d8cf77 + 389ff82 commit bbb4c5c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ThumbnailCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@ protected function doResize($src, $width, $height, $crop = false, $fit = false,
case 'jpg':
$img = imagecreatefromjpeg($src);
// Handle exif orientation
$exif = $this->exifOrientation ? exif_read_data($src) : false;
if ($this->exifOrientation && function_exists('exif_read_data')) {
$exif = exif_read_data($src);
} else {
$exif = false;
}
$modes = array(2 => 'H-', 3 => '-T', 4 => 'V-', 5 => 'VL', 6 => '-L', 7 => 'HL', 8 => '-R');
$orientation = isset($exif['Orientation']) ? $exif['Orientation'] : 0;
if (isset($modes[$orientation])) {
Expand Down

0 comments on commit bbb4c5c

Please sign in to comment.