Site logo

Archived topic

Is it possible to upload .webp images?

5 replies · Started by Paolo on February 28, 2019

Viewing posts 1–6 of 6

Hi there,

I don't know if this makes sense, but i'm trying to upload .webp images on WP. Is this possible?

Thanks!

Hi
I used this code in CODE SNIPPETS..PLUGIN, by one of your advisors, but it does not allow web p
Is it possible this has something to do with my CDN,,,,keyCDN,,,changes have to be made???

//** *Enable upload for webp image files.*/
function webp_upload_mimes($existing_mimes) {
$existing_mimes['webp'] = 'image/webp';
return $existing_mimes;
}
add_filter('mime_types', 'webp_upload_mimes');

//** * Enable preview / thumbnail for webp image files.*/
function webp_is_displayable($result, $path) {
if ($result === false) {
$displayable_image_types = array( IMAGETYPE_WEBP );
$info = @getimagesize( $path );

if (empty($info)) {
$result = false;
} elseif (!in_array($info[2], $displayable_image_types)) {
$result = false;
} else {
$result = true;
}

Howard

Can you try the plugin David recommended?

That should be the best solution.

The theme itself cannot control what you can/can't upload to the WordPress media library as that's handled by WordPress itself.

Will give it a try
Thanks
👍

No problem :)

This archived topic is closed to new replies.