Fixed ImageMedium constructor warning when file cannot be accessed

This commit is contained in:
Matias Griese 2019-01-30 11:20:12 +02:00
parent 6daf480bfc
commit 610c6c341c
2 changed files with 5 additions and 2 deletions

View File

@ -7,6 +7,7 @@
1. [](#bugfix)
* Fixed a bug in `FormFlashFile::moveTo()` not deleting the old file
* Fixed `FlexMediaTrait::getMedia()` trying to include uploaded but already moved media
* Fixed `ImageMedium` constructor warning when file does not exist
# v1.6.0-beta.8
## 01/25/2019

View File

@ -83,11 +83,13 @@ class ImageMedium extends Medium
$config = Grav::instance()['config'];
if (filesize($this->get('filepath')) === 0) {
$path = $this->get('filepath');
if (!$path || !file_exists($path) || !filesize($path)) {
return;
}
$image_info = getimagesize($this->get('filepath'));
$image_info = getimagesize($path);
$this->def('width', $image_info[0]);
$this->def('height', $image_info[1]);
$this->def('mime', $image_info['mime']);