Fixed media crashing on a bad image

This commit is contained in:
Matias Griese
2020-10-08 22:17:12 +03:00
parent 1eb85b366d
commit 4ba8e9e99d
2 changed files with 6 additions and 4 deletions

View File

@@ -3,6 +3,7 @@
1. [](#bugfix)
* Accessing page with unsupported file extension (jpg, pdf, xsl) will use wrong mime type [#3031](https://github.com/getgrav/grav/issues/3031)
* Fixed media crashing on a bad image
# v1.7.0-rc.17
## 10/07/2020

View File

@@ -55,10 +55,11 @@ class ImageMedium extends Medium implements ImageMediaInterface, ImageManipulate
if (!($this->offsetExists('width') && $this->offsetExists('height') && $this->offsetExists('mime'))) {
$image_info = getimagesize($path);
$this->def('width', $image_info[0]);
$this->def('height', $image_info[1]);
$this->def('mime', $image_info['mime']);
if ($image_info) {
$this->def('width', $image_info[0]);
$this->def('height', $image_info[1]);
$this->def('mime', $image_info['mime']);
}
}
$this->reset();