mirror of
https://github.com/processwire/processwire.git
synced 2025-08-11 09:14:58 +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;
|
$imageInfo = $this->imageInfo;
|
||||||
$filename = is_string($reset) && file_exists($reset) ? $reset : '';
|
$filename = is_string($reset) && file_exists($reset) ? $reset : '';
|
||||||
|
$ext = $this->ext;
|
||||||
|
|
||||||
if(!$reset && $imageInfo['width'] && !$filename) {
|
if(!$reset && $imageInfo['width'] && !$filename) {
|
||||||
return $imageInfo;
|
return $imageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->ext == 'svg') {
|
if($ext == 'svg') {
|
||||||
$imageInfo = array_merge($imageInfo, $this->getImageInfoSVG($filename));
|
$imageInfo = array_merge($imageInfo, $this->getImageInfoSVG($filename));
|
||||||
} else {
|
} else {
|
||||||
if($filename) {
|
if($filename) {
|
||||||
@@ -509,7 +510,7 @@ class Pageimage extends Pagefile {
|
|||||||
} else if($info) {
|
} else if($info) {
|
||||||
$imageInfo['width'] = $info[0];
|
$imageInfo['width'] = $info[0];
|
||||||
$imageInfo['height'] = $info[1];
|
$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);
|
$exif = $filename ? @exif_read_data($filename) : @exif_read_data($this->filename);
|
||||||
if(!empty($exif['Orientation']) && (int) $exif['Orientation'] > 4) {
|
if(!empty($exif['Orientation']) && (int) $exif['Orientation'] > 4) {
|
||||||
// Image has portrait orientation so reverse width and height info
|
// Image has portrait orientation so reverse width and height info
|
||||||
|
Reference in New Issue
Block a user