how do I add
.webpto 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, 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.
Trenne niemals Müll, denn er hat nur eine Silbe!