Problem/Motivation

Since an update of the module, the webp derivates of images always contain the orginal file extension before the .webp extension in the filename. This isn't necessary and broke existing image optimization pipelines. So for example

Original filename: image.png
Webp derivate filename: image.png.webp

Instead the webp derivate filename should be image.webp

Comments

s_leu created an issue. See original summary.

s_leu’s picture

Status: Active » Needs review
StatusFileSize
new2.68 KB

Attaching a patch that fixes this.

s_leu’s picture

StatusFileSize
new2.43 KB

Fixed some code that got accidentally removed in the previous patch

michaellander’s picture

How would you handle the situation where you upload:

example.jpg
example.png

If they both are in the same directory, and both generate an image style, how would you avoid filename collisions?

Phil Wolstenholme’s picture

The current suffix approach also makes this sort of thing easier:

https://github.com/uhop/grunt-tight-sprite/wiki/Recipe:-serve-WebP-with-...

rar9’s picture

D9.1.9 php 7.4.x

The patch #3 only seams to work partially.

The image are stored as described but all views using responsive images still look for images called .jpg.webp , so the image styles are all not found.

michaellander’s picture

Status: Needs review » Closed (works as designed)

I'm closing this as it's working as intended. If someone wants to come up with a way to solve filename collisions, then I'm open to reopening it, but I currently don't see a path forward.

sharique’s picture

To answer your query of following file name
example.jpg
example.png

new images will get following name
example.webp
example_1.webp

renaming new file is handled by EXISTS_RENAME flag in file system Api.