Avatar

Question About The Upload Function? (General)

by Auge ⌂, Monday, June 06, 2022, 11:17 (19 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


Complete thread:

 RSS Feed of thread