diff --git a/app/Controllers/Api/Images/Upload.php b/app/Controllers/Api/Images/Upload.php index 08fd516..79dcb6d 100644 --- a/app/Controllers/Api/Images/Upload.php +++ b/app/Controllers/Api/Images/Upload.php @@ -40,6 +40,19 @@ class Upload { if ($_FILES['image']['error'] != 4) { + $finfo = finfo_open(FILEINFO_MIME_TYPE); + $type = finfo_file($finfo, $_FILES['image']['tmp_name']); + if ($type === 'image/gif') { + if (NGALLERY['root']['photo']['upload']['allowgif'] === false) { + echo json_encode( + array( + 'errorcode' => 'FILE_NOTSUPPORTED', + 'error' => 1 + ) + ); + die(); + } + } $exif = new EXIF($_FILES['image']['tmp_name']); $exif = $exif->getData(); $upload = new UploadPhoto($_FILES['image'], 'cdn/img/'); diff --git a/ngallery-example.yaml b/ngallery-example.yaml index e1bb7c5..3f0a2c8 100644 --- a/ngallery-example.yaml +++ b/ngallery-example.yaml @@ -43,6 +43,7 @@ ngallery: allow: true premoderation: true defaultindex: 5.0 + allowgif: true comments: premoderation: false diff --git a/views/pages/Photo.php b/views/pages/Photo.php index 5326d81..1b38ef8 100644 --- a/views/pages/Photo.php +++ b/views/pages/Photo.php @@ -77,9 +77,9 @@ if ($photo->i('id') !== null) { i('moderated') === 0 && $moderated === true) { echo '