CMS MADE SIMPLE FORGE

CMS Made Simple Core

 

[#12720] Add WebP support for thumbnails in filemanager

avatar
Created By: Mathieu Muths (airelibre) (airelibre)
Date Submitted: 2024-05-28 01:50

Assigned To:
Resolution: None
State: Open
Summary:
Add WebP support for thumbnails in filemanager
Detailed Description:
Hi,

I suggest adding the WebP support for the thumbnails in FileManager / FilePicker

Quick fix, in modules/FileManager/lib/class.filemanager_utils.php from line 493
:

switch( $info['mime'] ) {
        case 'image/gif':
            $res = imagegif($i_dest,$dest);
            break;
        case 'image/png':
            $res = imagepng($i_dest,$dest,9);
            break;
        case 'image/jpeg':
            $res = imagejpeg($i_dest,$dest,100);
            break;
        }

--------------------------------
Replace with :
--------------------------------

switch( $info['mime'] ) {
        case 'image/gif':
            $res = imagegif($i_dest,$dest);
            break;
        case 'image/png':
            $res = imagepng($i_dest,$dest,9);
            break;
        case 'image/webp':
            $res = imagewebp($i_dest,$dest,90);
            break;
        case 'image/jpeg':
            $res = imagejpeg($i_dest,$dest,100);
            break;
        }


There should be other places to update ;)

Thanks

History