Ultimate Member - WebP file type support for image uploaders

Google has developed a modern image file format that has become popular, and it is called the WebP. WebP is explicitly created for the Web because it supports excellent lossless and lossy compression for online images. This will help web developers create smaller images or less bulky graphic sizes, producing faster-loading websites.

WebP requirements:

  • PHP 7.1.0
  • libwebp library/module
  • WordPress 5.8+
Browser Support
The visitor's web browser must support WebP for it to work. WebP images are supported by popular browsers such as:
  • Chrome (desktop & mobile)
  • Opera (desktop & mobile)
  • Firefox (desktop & mobile)
  • Microsoft Edge
  • iOS and macOS Safari (macOS 11 Big Sur and later only)
  • Safari browser supports WebP images partially at the time of writing.
Contents

Allowed image types in the field option for the Image field#

Ultimate Member image field uploader currently supports  png., jpeg., jpg., and gif—image file types.

So when you try and upload a photo with a WebP image file type, you will not be able to upload the picture, and an error message will appear "Sorry, this is not a valid image."

Adding the code snippet below will allow you to add the WebP image file type in UM image fields and be able to upload the WebP file to the uploader.

Cover & Profile Photo#

You will encounter the same issue when uploading a WebP image file type in UM cover and profile photo. The exact error message will appear. To be able to upload a WebP image file format, you need to use the code below:

Once you have added the code snippet, users can upload a WebP image file format in their cover and profile photos.

 User Photos extension#

When the user photos extension is activated, you will encounter an error that says, "image/webp files are not allowed," as shown in the image below.

You have to use the code snippet below to allow users to upload a WebP image file format in their photos and albums:

Social Activity & Groups discussions#

A user cannot upload a WebP image file format in Social Activity because it is not a valid image.

You can allow using WebP image file format while the Social activity extension is activated by using the code snippet below:

We have created this code example to provide guidance and to make it easier for you to implement this code into your website. However, we are not able to provide any support when it comes to customizing the plugin. If you need help implementing this code, please hire a developer.