Only JPEG files (and TIFF, which we don't support) have EXIF
This commit is contained in:
parent
bf8c26f835
commit
ca67e848eb
|
@ -76,24 +76,26 @@ class ImageFile
|
||||||
$this->width = ($info) ? $info[0]:$width;
|
$this->width = ($info) ? $info[0]:$width;
|
||||||
$this->height = ($info) ? $info[1]:$height;
|
$this->height = ($info) ? $info[1]:$height;
|
||||||
|
|
||||||
// Orientation value to rotate thumbnails properly
|
if ($this->type == IMAGETYPE_JPEG) {
|
||||||
$exif = exif_read_data($this->filepath);
|
// Orientation value to rotate thumbnails properly
|
||||||
if (isset($exif['Orientation'])) {
|
$exif = exif_read_data($this->filepath);
|
||||||
switch ((int)$exif['Orientation']) {
|
if (is_array($exif) && isset($exif['Orientation'])) {
|
||||||
case 1: // top is top
|
switch ((int)$exif['Orientation']) {
|
||||||
$this->rotate = 0;
|
case 1: // top is top
|
||||||
break;
|
$this->rotate = 0;
|
||||||
case 3: // top is bottom
|
break;
|
||||||
$this->rotate = 180;
|
case 3: // top is bottom
|
||||||
break;
|
$this->rotate = 180;
|
||||||
case 6: // top is right
|
break;
|
||||||
$this->rotate = -90;
|
case 6: // top is right
|
||||||
break;
|
$this->rotate = -90;
|
||||||
case 8: // top is left
|
break;
|
||||||
$this->rotate = 90;
|
case 8: // top is left
|
||||||
break;
|
$this->rotate = 90;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// If we ever write this back, Orientation should be set to '1'
|
||||||
}
|
}
|
||||||
// If we ever write this back, Orientation should be set to '1'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user