Fix warning when displaying PDF in Media manager

Trying to access array offset on value of type bool in
.../inc/JpegMeta.php on line 1322
This commit is contained in:
Damien Regad 2021-01-27 00:59:26 +01:00
parent c10f256a39
commit bbdbbeb873
1 changed files with 75 additions and 73 deletions

View File

@ -1317,9 +1317,10 @@ class JpegMeta {
$this->_info['file']['UnixTime'] = filemtime($this->_fileName);
// get image size directly from file
$size = getimagesize($this->_fileName);
if ($size = getimagesize($this->_fileName)) {
$this->_info['file']['Width'] = $size[0];
$this->_info['file']['Height'] = $size[1];
// set mime types and formats
// http://php.net/manual/en/function.getimagesize.php
// http://php.net/manual/en/function.image-type-to-mime-type.php
@ -1391,6 +1392,7 @@ class JpegMeta {
default:
$this->_info['file']['Mime'] = 'image/unknown';
}
}
} else {
$this->_info['file'] = array();
$this->_info['file']['Name'] = \dokuwiki\Utf8\PhpString::basename($this->_fileName);