pThumb
pThumb copied to clipboard
Can't create webp images with Resizer
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]]"
/>
- Set phpthumbof.use_resizer == 0: webp images are created.
- Set phpthumbof.use_resizer == 1: pthumb returns a crop in the original format located inside the image-cache and I find an error message inside the modx log file.
[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:
- modxcloud
- modx 2.7.3
- pthumb 2.3.3
- contentblocks 1.8.15
- resizer 1.0.2-beta
Regards,
pepebe
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.
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 :)
@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?
@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?