Jump to content

webp supported in image field?


benbyf
 Share

Recommended Posts

Tested on PW 3.0.148 on the image field and the site is able to upload and present the webp image on the front end, but in the admin I get a blank transparent image with the warning  [image url].webp - not a supported image type

Just wondered if the image field in new PW versions had a fix for this or not?

Link to comment
Share on other sites

Yes, webp only is an output format, not a source image or master image format. If you want to use only webp as original image and output image (WITHOUT resize methods) you can use it within a files field. Within image fields is not supported and doesn't make much sense.

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

Hi @horst thanks for getting back! I guess I have a very specific use case. My client uses a lot of gif’s which are bloating the front end… been migrating most images to webp and found that webp also does animation. Did a quick test and found a webp animation was roughly 10x smaller than the small gif.

woudl love to allow my clients to upload and view in the admin as they do a lot of arranging of images. However, encoding an image to webp doesn’t keep any animations on the server (also the quality is worse going from giff to webp instead of jpg slides to webp).

I guess I can’t see any reason why if presented with a webp upload the image field couldn’t just display as is in the backend… or maybe toggle this on in settings?

 

 

  • Like 1
Link to comment
Share on other sites

6 minutes ago, benbyf said:

I guess I can’t see any reason why if presented with a webp upload the image field couldn’t just display as is in the backend

This is by design, because we have jpeg, gif and png as master images that can be used as originals for resizing, cropping, etc. and from the final variations optionally a webp can be created. The webp is called upon an regular page image object: $image->webp()->url.

We would need a new Fieldtype or Inputfield for images only to collect and arrange images, without modifying methods. This could be able to support other file formats too. (TIFF, BMP or others maybe).

But with the current image field, webp can't be handled as original image format. It's by design. Maybe an extention of the file field, that creates and displays a thumbnail additionally to the filename(s) would help?

Link to comment
Share on other sites

18 minutes ago, benbyf said:

However, encoding an image to webp doesn’t keep any animations on the server (also the quality is worse going from giff to webp instead of jpg slides to webp).

I read something about better using ffmpeg and create videos from animated gifs. But I haven't done anything about it until now. If you are interested, it was in a book from Adi Osmani: Image Optimization

My son uses ffmpeg a lot on CLI on linux. It's on my wish list to investigate further, but time is rare.

Link to comment
Share on other sites

sure, I use webm and mp4's where i can, just be nice to use images OR have some good way of dropping hundreds of images onto a page, re arrange them and add videos in the same area... which ultimately is my issue. Repeaters are good option but theres no way to quickly make LOTs of repeaters with drag and drop files...

I think the best solution for me would be able to drop a load of files into a field and for it to populate a repeater filled with the same number of items filling the first image or file field it fields on each new item...

Link to comment
Share on other sites

  • 4 months later...
On 8/17/2021 at 7:15 PM, horst said:

But with the current image field, webp can't be handled as original image format. It's by design.

Hey @horst why is that by design? I don't understand why we should not be allowed to upload webp directly if we want to display webp afterwards?

Link to comment
Share on other sites

  • 1 year later...

I have more and more customers complaining that they can't upload webp images. I understand that webp is not the ideal master image format, but neither is jpeg. The webp browser support is also so good now that it would not be necessary to generate jpeg/png versions from webp. 

  • Like 4
Link to comment
Share on other sites

For those who just want to let users upload WEBP format and are looking for a workaround, here is a simple module that converts WEBP to JPG on upload:

I wonder though... how is it that the user acquired the WEBP image in the first place? Surely they didn't just pinch it off somebody else's website... 🤔

  • Like 4
  • Thanks 1
Link to comment
Share on other sites

  • 8 months later...

Sorry to catch up this older topic again, but there seems to be no changes in sight so far. I also still would find it useful to have webp as input format.

The need- or the wish- to use it, is from my experience originated in Google requesting (or recommending) webp format in order to reduce loading times when doing speed tests with lighthouse.

So people start to use and store images in webp format.

Then to convert them back to jpg or png just to output these as webp again makes no sense at all.

  • Like 3
Link to comment
Share on other sites

I can't quite see how WEBP images are different from JPEGs or GIFs in this regard, and why they shouldn't be allowed as source images. All these formats are lossy and have the potential to look fantastically terrible when set to high compression rates, so there's really no ideal input format apart from TIFFs and lossless PNGs.

The browser and OS support of WEBPs is such that we should allow them as source format if the server is configured to resize them. From what I've seen, most GD and Imagick installations these days handle WEBP just fine. With websites now outputting WEBP files, a growing number of PW users will expect to keep working with them as they've always been working with other common formats.

  • Like 3
Link to comment
Share on other sites

  • 3 months later...

Hey @horst and @Robin S here is a real use case from today: A website mockup with transparent background.

Exporting it as PNG results in 369kB:

P6J1VWc.png

WEBP 109kB

kulqfrc.png

WEBP created from PNG via PW: 66kB

6bcXxDm.png

That seems to be a 90% quality setting 🙂 

bS0ErYr.png

@Robin S is there a reason why your module converts to JPG and not PNG? I'd lose the transparency when using JPG...

I guess I export PNG and use that for my website for now, but I'd still think that it would be nice to support WEBP @horst maybe you can rethink that?

Link to comment
Share on other sites

1 hour ago, Ushavilash said:

Hello @benbyf,

You can update to the latest version of PW. If that doesn't solve the problem, convert the WebP images to a supported format like JPEG or PNG for admin use.

Thanks for your help, but not sure thats the issue. I will however check the latest version of PW to check support and report back

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...