How to get xwiki to work with the webp image file format?

I had a look in extensions, searched this forum, googled it - and then I thought maybe some nice person here can help me with this.
Drag’n’drop of pictures works fine for anything but webp. It is kind of annoying to remove the link (that is what xwiki inserts instead of the picture), then convert pictures and then put them where they were meant to be in the first place.

It seems to me .webp files are not recognised as images by the WYSIWYG editor. When you paste a .webp file it is being treated as any other non image file thats being linked to.

As soon as you throw it into the image macro it works as any other image (as ‘normal’):

example webp

It seems to me this is a matter of adding .webp to the WYSIWYG image extensions.

General (TIL): webp is a compressed way of storing known image extensions like .jpeg / .gif etc. developed by google WebP Gallery | Google Developers

Update 1: I attempted to change the default attachment that are displayed inline (in xwiki.properties - line 885 for me) and added ,image/webp

#-# [Since 5.2M2]
#-# Define the kind of attachment that can be displayed inline. You can either choose to do it through a whitelist
#-# (only the mimetypes defined in this list would be displayed inline) or a blacklist (every mimetype that is not in
#-# this list would be displayed inline if possible).
#-# Note that only one configuration is used between the whitelist and the blacklist, and the whitelist always have
#-# the priority over the blacklist. Also note that these configurations exist for security reason so they are only
#-# impacting attachments added by users who do not have programming rights.
#-# If you want to force downloading some attachments types please check the configuration below.
#-#
#-# By default we use the following whitelist (coma separated list of values).
attachment.download.whitelist=audio/basic,audio/L24,audio/mp4,audio/mpeg,audio/ogg,audio/vorbis,audio/vnd.rn-realaudio,audio/vnd.wave,audio/webm,image/gif,image/jpeg,image/pjpeg,image/png,image/tiff,text/csv,text/plain,text/xml,text/rtf,video/mpeg,video/ogg,video/quicktime,video/webm,video/x-matroska,video/x-ms-wmv,video/x-flv,image/webp

This made it so I can now copy paste webp images from the clipboard which then shows it as an image.

However when I upload .webp files its still being treated as a downloadlink… someone more accostumed to xwiki will undoubtedly be able to help with that… perhaps this helps alleviate some of the pain

1 Like

2023-02-21T08:00:00Z Thank you so much! You made my day! :grinning: :grinning: :grinning:

Simply whitelisting the file format was all it needed. I added ,image/webp to the attachment section in C:\xwiki14-9\webapps\xwiki\WEB-INF\xwiki.properties just like you showed me how to do. Problem solved, drag’n’drop of webp-images works perfectly.

Note: Loading... created to allow webp to be supported by default.

1 Like