modxcms / pThumb

A better phpThumbOf
46 stars 29 forks source link

Can't create webp images with Resizer #64

Open pepebe opened 4 years ago

pepebe commented 4 years ago

I'm trying to create webp images with pthumb, but using Resizer instead of phpThumb seems to cause problems.

Steps to reproduce:

Create a webP Thumbnail with pThumb:

        <source 
            srcset="[[+crops.xl.url:pthumb=`w=1140&q=100&f=webP`]]"
            media="(min-width: 1200px)"
            data-breakpoint="xl"
            data-org="[[+crops.xl.url]]"
        />
[2020-07-03 10:42:19] (ERROR @ /paas/*****/www/core/components/phpthumbof/model/phpthumbof.class.php : 156) [pThumb] Resource: 1 || Image: /paas/c0583/www/crops/lg.95a9428b.cm6p6087_1.jpg
Could not cache thumbnail to file at: /paas/*****/www/assets/image-cache/lg.95a9428b.cm6p6087_1.54dea866.webP
Resizer debug output:
    [0] => Resizer v1.0.1
    [1] => Using Imagick
    [2] => Input file: /paas/****/www/crops/lg.95a9428b.cm6p6087_1.jpg
    [3] => Input options: 
  'q' => '100',
  'f' => 'webP'
    [4] => *** Error *** Save operation failed

Environment:

Regards,

pepebe

pepebe commented 4 years ago

Quick update: The propblem seems to go deeper and the symptoms are highly erratic. I just saved the resource, reloaded the frontpage and suddenly all images are jpg again. Not a single webp image.

I'll investigate some more and post updates as soon as I find out more.

sepiariver commented 4 years ago

Hi @pepebe it has to do with the version of Imagine being used by Resizer. The latest version that could be used in Resizer is 0.7.x. Upgrading to 1.x and higher requires quite a bit of refactoring. I have a fork of Resizer in which I'm working on that, but it's slow going. If you are interested in collaborating on it, let's discuss :)

patrickatwsrn commented 4 years ago

@sepiariver My graphic-foo is limited, but I will try to support your cause. Is there a todo list with things that need to be done?

hugopeek commented 3 years ago

@sepiariver I'm having these issues too and just tried installing your 2.0.1-dev package. Got it working after changing line 354 in Reductionist.php: $image->getFormat() was throwing a fatal error and changing it to $image->get('format') seems to work.

Still no luck with the webp images though.. How far along would you say this dev version is?