plan2net / webp

Create a WebP copy for images (TYPO3 CMS)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

no webp copies for images in typo3temp

chrirauch opened this issue · comments

Hi

Just trying out your Extension. So far the conversion for images in fileadmin subfolders works great. But none of my images in typo3temp/assets/images get a webp copy... In my case nearly all of the images get processed by gifbuilder to add a transparency mask...

Am I missing something on my side or is it the normal behaviour? I was not sure from reading the documentation... At the top it says

What does it do?

Adds an automagically created WebP copy for every processed jpg/jpeg/png image in the format

a bit further down it says:

Since version 1.1.0 all images in every local and writable storage will be saved as a copy in Webp format by default

So this probably means I'm out of luck if i want webp copies for my gifbuilder images, because they are not in a typo3 file storage... Just wanted to know..

@chrirauch can you provide some details on your setup on how you generate these images in typo3temp/assets/images?
Then I can take a look at it.
The extension processes every file through listening for the AfterFileProcessingEvent event (TYPO3 CMS 10).

@wazum

thanks for looking into this. I'll make reduced example for you to test... But i'll probably need until the weekend to get back to this

Hi. I have the same "problem/feature" here. Just tried this extension.
In my case the images are in typo3temp/assets/external/
The processed files are under typo3temp/assets/processed/
But no webp files will be generated.

A simple example to test i think will be:
<f:image src="/typo3temp/assets/external/example.jpg" />

I think this part is responsible for the behaviour:
// Process files only in a local and writable storage if (!$this->isStorageLocalAndWritable($processedFile)) { return false; }

Regards

I created a file storage that points to typo3temp/assets/external/.
Processed files now will be generated under typo3temp/assets/external/processed

But $storage->getStorageRecord()['uid'] in AfterFileProcessing::isStorageLocalAndWritable() is also in this case always 0.

Why is the check for // Ignore files in fallback storage (e.g. files from extensions) needed? webp files makes sense in any case.

Regards

@samowitsch no, it does not make sense to create files on a server in directories of possibly versioned files (extensions, …).

Why would someone you use a path like /typo3temp/assets/… in one of the view helpers (you gave the following example: <f:image src="/typo3temp/assets/external/example.jpg" />)? That's not something I would do (temp = temporary). Maybe this was just a bad example, but then please give some real life examples and more details, what you want to achieve.

@wazum i didnt get your point? You have versioned files in a file storage folder? Or a file storage that point to an extension folder? For me this sounds weird, too ;o) All processed files in my case will be saved in fileadmin/processed or typo3temp/assets/processed. This has nothing to do with versioned files?

The images i fetch comes from an API. These would be saved temporarily in typo3temp for later processing. What i found quite handy that i could delete them from BE Maintenance module if needed. The images will be fetched if needed or not when available in typo3temp.
This is my use case. I dont know what @chrirauch does ;-) Maybe something similar.

Maybe you can explain me the case when this condition is needed?

        // Ignore files in fallback storage (e.g. files from extensions)
        if ($storage->getStorageRecord()['uid'] === 0) {
            return false;
        }

Update: I am using now the core functionality only for webp without this extension as described here: https://www.in2code.de/aktuelles/webp-responsive-images-und-lazy-loading-in-typo3-einbauen/.
The behaviour that in typo3temp no webp files will be generated is the same.
I moved my files outside typo3temp and added also an file storage record for this folder.