Question About The Upload Function? (General)

by Sam, Monday, June 06, 2022, 01:44 (114 days ago)

To the My Little Forum dev, how do I add

.webp

to the upload function so users can upload this type of image?

Thank you

Tags:
upload, webp, feature wish

Avatar

Question About The Upload Function?

by Auge ⌂, Monday, June 06, 2022, 11:17 (114 days ago) @ Sam

Hello

how do I add .webp to the upload function so users can upload this type of image?

It is not only to add a further file type, because there are a few steps to alter.

The script checks the upload for being an image with getimagesize (a meanwhile not recommended but working way). Currently it checks, if the reported filetype is 1, 2 or 3 in the return value $image_info[2], which corresponds with GIF, JPEG, and PNG. Here we would have to add the value for WEBP (what ever the value is) in a few places.

Furthermore the upload handling (resizing and resampling) has to take the "new" image type into account. Where the adaptions to getimagesize and the surrounding code is a no-brainer, the changes to the resizing and resampling code needs a bit of research for the status of the WEBP-support in the utilised functions or for similar available functions with WEBP-support. That's no rocket science but also not a five-minute-task.

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!

Tags:
image, upload, webp

Avatar

Upload of WebP-images

by Auge ⌂, Monday, June 06, 2022, 13:45 (114 days ago) @ Sam

Hello

how do I add .webp to the upload function so users can upload this type of image?

I've implemented WebP-support for the upload feature and opened the pull request (PR) #623 for it. In my first tests the enhancement worked flawless as described in the description of the PR. I will perform a few further tests and try to make it ready for the next release.

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!

Tags:
feature, image, upload, webp

RSS Feed of thread