alkacon / opencms-core

The Java open source content management system by Alkacon Software
http://www.opencms.org
GNU Lesser General Public License v2.1
520 stars 575 forks source link

Webp image format #775

Closed glonis closed 9 months ago

glonis commented 10 months ago

HI, on opencms version 14 there are problems displaying images in webp format. In particular, in the preview inside content the image is not resized, unlike the jpg ones. Also the scaling of the image with the command image.webp?__scale=w:1200,h:1200,t:2,c:transparent,p:0 does not work (it should become a square image instead it keeps the original format). Finally, due to this problem the image gallery is very slow to load.

A thousand thanks Greetings Joseph

gWestenberger commented 9 months ago

The image scaler doesn't support webp.

kaiwidmann commented 9 months ago

It seems to be possible using the library "webp-imageio" described here: https://genuinecoder.com/java-webp-image-read-save-tutorial/ It adds WebP support to the native Java image classes.

It's as simple as dropping a jar to the lib folder (or adding a corresponding dependency), my first tests are really promising, sizes are now correct, image scaling is working.

Existing images have to be re-uploaded, I guess the size is determined during upload.