Webp format doesn't seem to be found

On newer themes there is usually a format=webp

I thought the storage adapters would automatically convert uploaded images to webp if, for example, I uploaded a jpeg. I’ve been digging around in storage adapters for quite a while trying to figure out what creates the webp files.

Am I a silly goose that has been uploading jpegs when I should be uploading webp? Where does the format=webp usually come from? Is there something that automatically converts them?

Never mind. I am not a silly goose. There’s something weird going on where formats/webp isn’t created at all even if you upload a webp. :(

Where in here are the webps generated? Or what is supposed to generate them upstream?

Storage adapters don’t automatically convert formats. Format=webp works for images stored by ghost itself (in the content folder).

I think @jannis did some work on getting formats or sizes working for his setup, but I’m not sure whether he improved the adapter or abandoned it…

I guess the custom storage adapters are just kind of abandoned?
None of them have been updated in years and I can’t find where the image pipeline makes webp even for localstorage.

As I understand it (haven’t looked at that part of the code), the images are actually generated when first requested, not when uploaded. So you might be looking in the wrong place….

oh hm
Well with a storage adapter it would potentially never hit any sort of read/serve/etc function so I guess that solves why I don’t have a formats/webp

I guess this is the “magic”

Oh and here:

I ended up abandoning it in favour of a CDN (which was my use case for using an S3 adapter) – that was less pain than figuring out the sizing issue I faced.

I see.
Yeah I think tomorrow I might hack around in my storage adapter and try to add the webp upload. I’m using GCP.

You’re probably right - would be way easier to just slap a CDN feature on it.

Just FYI this is a horrible rabbit hole.
Even if you convert to webp Ghost still serves everything with a jpeg prefix.