mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 16:26:59 +02:00
Fix issue processwire/processwire-issues#1618 prevent exif_read_data call on non-jpg images in Pageimage.php
This commit is contained in:
@@ -489,12 +489,13 @@ class Pageimage extends Pagefile {
|
||||
|
||||
$imageInfo = $this->imageInfo;
|
||||
$filename = is_string($reset) && file_exists($reset) ? $reset : '';
|
||||
$ext = $this->ext;
|
||||
|
||||
if(!$reset && $imageInfo['width'] && !$filename) {
|
||||
return $imageInfo;
|
||||
}
|
||||
|
||||
if($this->ext == 'svg') {
|
||||
if($ext == 'svg') {
|
||||
$imageInfo = array_merge($imageInfo, $this->getImageInfoSVG($filename));
|
||||
} else {
|
||||
if($filename) {
|
||||
@@ -509,7 +510,7 @@ class Pageimage extends Pagefile {
|
||||
} else if($info) {
|
||||
$imageInfo['width'] = $info[0];
|
||||
$imageInfo['height'] = $info[1];
|
||||
if(function_exists('exif_read_data')) {
|
||||
if(function_exists('exif_read_data') && ($ext === 'jpg' || $ext === 'jpeg')) {
|
||||
$exif = $filename ? @exif_read_data($filename) : @exif_read_data($this->filename);
|
||||
if(!empty($exif['Orientation']) && (int) $exif['Orientation'] > 4) {
|
||||
// Image has portrait orientation so reverse width and height info
|
||||
|
Reference in New Issue
Block a user