$file->resize() doesn't seem to be working for WEBP images

Hey there, I’m trying to resize images but the outputted file doesn’t seem to exist, it just reverts to the original file. After some digging, I realised it has something to do with gd not supporting .webp files. Is there a fix for this?

Not out the box, but you could give my plugin a shot…

GD and ImageMagik do support webp, but you need the build that includes support for it installed.

You could try switching thumbdrivers to IM… you might get lucky and find your host installed IM with WebP support, but didnt bother to do with with GD.

I actually just installed this. Switching to IM didn’t help though. Do you have simple guide to enable webp, especially on the server?

Depends what kind of hosting you have. You might be able install yourself, but if its shared hosting, you will be out of luck if your host is unwilling to install it.

You might find this article useful…

The plugin uses rosell-dk/webp to do the actual conversion, which supports alot of image librarys, not just GD and IM. It will use the first one it finds…

Hey @jimbobrjames , so I was able to get this working locally but I’m struggling to get this to work on the server. I went through the process of installing a custom PHP and then installed ImageMagick and it seems to be up and running when looking at my phpinfo file.

I think the config may not be able to locate convert binary so I tried to set the absolute path but I’m not sure how that actually works.

The PHP is installed in the root folder akuko.studio. If this is the case, is this the right path?

Wanted to add more to this, it seems resizing any image doesn’t work for me at all, even if it’s a jpg. Anyone know what’s going on here?

Locally or remote?

Using GD or imageMagick drivers?

Both locally and remote using GD. I tried using ImageMagick, I tried updating it and then that worked but remotely it didn’t work. I figured it would out of the box.

Is GD definitely available and enabled?

Are the original files moved to the media folder? Are the jobs for the thumbs created in the media folder?

Are you sure the bin path is correct?

The folder doesn’t contain the files at all.

Yeah, im a bit lost on that bit, I have a post above that show the path I have in my project. is that right?

Is the folder writable?

Yeah, when I updated my local version if im resize started to work but only locally so I think the folder is writable but it seems GD doesn’t seem to work.

Are there any logs or settings I can share to help debug?

I don’t quite understand this sentence. If resizing works locally, then one of the drivers seems to do the job? Which one is currently active locally? And what is your local development environment?

Have you checked phpinfo()?

@texnixe Let me reset and start from scratch.

I’m currently trying or use .webp where possible in my project. I’m trying to optimise each image on the fly using $file->resize() and as far as I can see, I am unable to get the assets generated when the format is .webp. I tested $file->resize() with .jpg and .png and it works great but not with .webp.

From some light investigation I may need to update GD (currently running 2.1.0) and it seems they added .webp support in 5.6.12. I tried switching to IM but looking at my phpinfo(); it seems its not installed.

How do I update GD, I couldn’t see any links for how to update it.

I would talk to your web host in the first instance. Thats a pretty old version. If they are unwilling to help, I would consider moving to a better host. We can recommend some - infact i think there is a list of Kirby freindly hosts somewhere on the forum.

@jimbobrjames I will reach out to my provider to see if they can update this for me, I’m with Dreamhost (not sure if they’re on the list). But also I’m running into the same issues locally. Is there a way I can update GD locally?