Skip to content

Add support for webp images #41

Description

@maagenta

I think it is very important and convenient to use webp images, so I edited the code of Image Gallery Pro to add support to webp images.

1. Change the line 48 of the vendors/novaGallery.php:
$images = glob($dir.'/*{jpg,jpeg,JPG,JPEG,png,PNG}', GLOB_BRACE);
with:
$images = glob($dir.'/*{jpg,jpeg,JPG,JPEG,png,PNG,webp,WEBP}', GLOB_BRACE);

2. Edit the line 100 of vendors/SimpleImage.php:
if(!preg_match('/^image\/(gif|jpeg|png)$/', $this->mimeType)) {
with:
if(!preg_match('/^image\/(gif|jpeg|png|webp)$/', $this->mimeType)) {

3. Edit the line 67 and 70 of app/BluditImageGalleryHelper.php
Line 67:
acceptedFiles: ".jpg,.jpeg,.png",
with:
acceptedFiles: ".jpg,.jpeg,.png,.webp",
Line 70:
dictInvalidFileType: "'.$L->get('This is not a JPEG or PNG.').'",
with:
dictInvalidFileType: "'.$L->get('This is not a JPEG, PNG or WEBP.').'",

I think it could be cool to create a new version adding this simple but useful feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions