Only JPEG files (and TIFF, which we don't support) have EXIF

This commit is contained in:
Mikael Nordfeldth 2014-05-12 14:45:23 +02:00
parent bf8c26f835
commit ca67e848eb
1 changed files with 19 additions and 17 deletions

View File

@ -76,9 +76,10 @@ class ImageFile
$this->width = ($info) ? $info[0]:$width;
$this->height = ($info) ? $info[1]:$height;
if ($this->type == IMAGETYPE_JPEG) {
// Orientation value to rotate thumbnails properly
$exif = exif_read_data($this->filepath);
if (isset($exif['Orientation'])) {
if (is_array($exif) && isset($exif['Orientation'])) {
switch ((int)$exif['Orientation']) {
case 1: // top is top
$this->rotate = 0;
@ -96,6 +97,7 @@ class ImageFile
// If we ever write this back, Orientation should be set to '1'
}
}
}
public static function fromFileObject(File $file)
{