Jump to content

WebP image generation, without Jpg


pepperoni

Recommended Posts

Hi guys,

So I'm trying to achieve all my product images to use webp format, AND not create other unnecessary formats like jpg.

I have tried two different things.

1. Having the 'Multiple image formats' Enabled in New & Experimental Features.

image.png.76b5f442da21b659c8f9c580c93afee2.png

and having chosen 'WebP' in Image Settings.

image.png.2fc17db448a60b7b4320b2201630cdf5.png

With this configuration I confirm we can achieve webp image generation but at the same time it generates same images in jpg format too! That it not desirable for me, as I won't use the jpg files and it increases the account file size.

 

2. The second thing I tried is have the 'Multiple image formats' Disabled in New & Experimental Features.

image.png.cc10c6574b70f3c63f24c0bc00c45260.png

This makes the Image settings look a bit different. So here is what I have, Use WebP for all images.

image.png.60c2b44d2a87ac30e6ccb16ae7db0be4.png

With this configuration, the system generates images only in one format. The funny thing is the format is weird. You get .jpg files but the images are not jpg encoded, they are webp encoded. Think of it as in the first option above you take a webp image and you just rename it to .jpg, ie my_image.webp -> my_image.jpg.

 

What I'm trying to do is just get webp images (not any other formats). Second configuration above is very close. If only the generated images had .webp instead of .jpg.

Can anyone point me in the right direction of what is the file responsible for the naming of the images? I can change the code myself.

 

If someone had achieved similar thing using first configuration, then that I'd be fine with it too.

Please shed some light if you know more.

many thanks

prestashop version 8.1.3

 

 

Edited by pepperoni (see edit history)
Link to comment
Share on other sites

Hi endriu107,

Thanks for the reply.

Do you know how to change the jpg extension to webp please?

I don't understand the logic of this. If an image is webp then it should have the webp mime.

many thanks

Link to comment
Share on other sites

5 minutes ago, pepperoni said:

If an image is webp then it should have the webp mime.

and it have that mime. Image extension is not important, prestashop by default save images with jpg extension but it really could be webp, png or avif.

I think you want fix something what is not broken because ther is no reason to change extension when mime is correct.

Link to comment
Share on other sites

 Hi endriu107,

Thanks again.

We are getting to a different subject here.

I'd like to know how to get the .webp file extension on images when I select webp in prestashop.

Any idea which file(s) responsible for this please?

many thanks

Link to comment
Share on other sites

  • 10 months later...
On 1/22/2024 at 6:20 PM, endriu107 said:

Why?

Because Google PageSpeed request .webp format and .jpg is a negative SEO.

And anyway the Mime remains Jpg, all this should be resolved, or at least it would be nice to understand where the file containing the Webp generation function is located, so that it can be repaired.

Edited by Luigi Donato (see edit history)
Link to comment
Share on other sites

As explained, you can use any extension you like, but no browser or search engine will read it. The only real information about the type of image to be displayed is the MIME type.

Test your site with pagespeed and you won't get any errors on the image format, even if the extension is .jpg, if your image is in WebP.

All CDNs that automatically transform images don't change the file extension at all, to avoid unnecessary processing and redirection errors, and yet it works perfectly.

It's like DPI on images, it doesn't matter on the web.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...