News:

Support the VirtueMart project and become a member

Main Menu

webp no fully support in VM

Started by vdweb.cz, April 10, 2024, 19:10:32 PM

Previous topic - Next topic

vdweb.cz

Hi in 4.2.6 10972 you have write in upload image this text:

Supported filetypes for thumbnail creation GIF, JPG, PNG, WBMP, WEBP

But when you click on: Select a file -> WEBP is not in support list...

Even if you click on all file types and upload webp after that VM dont create thumbnail.

vdweb.cz

Hi in 4.2.8 11000 is not WEBP support

here is the solution in few rows:

administrator/components/com_virtuemart/helpers/img2thumb.php

AFTER ROW 215 ADD:
                case "webp":
                    if( function_exists("imagecreatefromwebp") ) {
                        $orig_img = imagecreatefromwebp($filename);
                    } else {
                        $app = JFactory::getApplication();
                        $app->enqueueMessage('This server does NOT suppport auto generating Thumbnails by webp');
                        return false;
                    }
                    break;





AFTER ROW 434 ADD:

            case "webp":
                if (strtolower(substr($fileout,strlen($fileout)-5,5))!=".webp")
                    $fileout .= ".webp";
                return imagewebp($new_img,$fileout);
                break;



AFTER ROW 476 ADD:

case "webp":
header ("Content-type: image/webp");
return imagewebp($new_img);
break;



AND in file
administrator/components/com_virtuemart/helpers/mediahandler.php

FIND
if($file_extension == 'jpg' || $file_extension == 'jpeg' || $file_extension == 'png' || $file_extension == 'gif'){
REPLACE
if($file_extension == 'jpg' || $file_extension == 'jpeg' || $file_extension == 'png' || $file_extension == 'gif' || $file_extension == 'webp'){

Milbo

Thank you,
great work. I wonder if the prior patch was working for imagecreatefromstring. I added it to the code and will committ it next time.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/