Commit 0a308217 authored by Cédric Anne's avatar Cédric Anne Committed by Johan Cwiklinski

Fix warning on missing images

parent 5042df42
......@@ -1548,6 +1548,9 @@ class Document extends CommonDBTM {
* @return boolean
*/
public static function isImage($file) {
if (!file_exists($file)) {
return false;
}
if (extension_loaded('exif')) {
$etype = exif_imagetype($file);
return in_array($etype, [IMAGETYPE_JPEG, IMAGETYPE_GIF, IMAGETYPE_PNG, IMAGETYPE_BMP]);
......
......@@ -220,7 +220,8 @@ class Document extends DbTestCase {
[__DIR__ . "/../../pics/add_dropdown.png", true],
[__DIR__ . "/../../pics/corners.gif", true],
[__DIR__ . "/../../pics/PICS-AUTHORS.txt", false],
[__DIR__ . "/../notanimage.jpg", false]
[__DIR__ . "/../notanimage.jpg", false],
[__DIR__ . "/../notafile.jpg", false]
];
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment