Composer Dependency Changed ? Pending

User tests: Successful: Unsuccessful:

avatar stell
stell
10 Mar 2022

A lot of people will continue to use Joomla 3 for some time, yet they want to use WebP images.
This is a small adjustment to let extensions like media manager accomplish that. Our extensions are using the J4 WebP support for resizing and stuff, and this would be good to offer WebP for all the J3 people still around.

Pull Request for Issue # .

Summary of Changes

webp Support in Image.php

Testing Instructions

$fullpath = 'path/to/image.webp';
$fullpath_resized = 'path/to/image_resized.webp';

try {
    $image = new Image($fullpath);
} catch (Exception $e) {
    return false;
}

$properties = $image->getImageFileProperties($fullpath);

switch ($properties->mime) {
    case 'image/webp':
        $imageType = \IMAGETYPE_WEBP;
        break;
    case 'image/png':
        $imageType = \IMAGETYPE_PNG;
        break;
    case 'image/gif':
        $imageType = \IMAGETYPE_GIF;
        break;
    default:
        $imageType = \IMAGETYPE_JPEG;
}

$image = $image->cropResize(1024, 768);
$image->toFile($fullpath_resized, $imageType, ['quality' => 85]);

Actual result BEFORE applying this Pull Request

Attempting to load an image of unsupported type WebP

Expected result AFTER applying this Pull Request

Successful handling of WebP images

Documentation Changes Required

avatar stell stell - open - 10 Mar 2022
avatar stell stell - change - 10 Mar 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 10 Mar 2022
Category External Library Libraries Composer Change
avatar brianteeman
brianteeman - comment - 10 Mar 2022

This is not be complete as you would also need to update the options for the media manager to add webp as a legal file extension and image/webp as a legal mime type.

Actually you can use webp right now with J3 by just updating the options - you just dont get a preview image

avatar stell
stell - comment - 11 Mar 2022

It's not about the media manager, but the possibility to use webp inside the J3 image package.

avatar brianteeman
brianteeman - comment - 11 Mar 2022

This is a small adjustment to let extensions like media manager accomplish that.

not about the media manager,

@zero-24 your decision

avatar stell
stell - comment - 11 Mar 2022

Extensions like media manager means extensions like media manager. So not media manager.
We use the image package to create thumbnails, and it would be good to handle it the same way as in J4 and not outside the workflow.

avatar Quy
Quy - comment - 11 Mar 2022
avatar Quy Quy - close - 11 Mar 2022
avatar Quy Quy - change - 11 Mar 2022
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2022-03-11 19:36:13
Closed_By Quy
Labels Added: Composer Dependency Changed ?
avatar stell
stell - comment - 11 Mar 2022

@Quy Is that package an active dependency and what is 2.0 branch?

avatar brianteeman
brianteeman - comment - 11 Mar 2022

@Quy thats why I said it was up to @zero-24 - that library is archived. If they want it to go into j3 then they need to convince @zero-24 to allow a new feature

Add a Comment

Login with GitHub to post a comment