Gen_Nausica
New Creator

Webp-conversion in FirstSpirit

Dear Community,

I was wondering, if FirstSpirit has a way of converting all images to webp when rendering them, even if they were uploaded in a different format (e.g. jpg)?

Any advice will be welcome :).

Thank you and best regards,

Jenny

4 Replies
hoebbel
Crownpeak employee

Dear Jenny,

yes, that is possible (if the FirstSpirit version is not too old)

You can find the corresponding documentation here:

https://docs.e-spirit.com/odfs/template-develo/template-syntax/functions/instructions/ref/index.html

The example script can either be executed as a script or within a beanshell console.

Best regards
Holger

@hoebbel 

I set following properties to convert all images to webp.

project = context.getProject();
project.lock();
properties = new java.util.LinkedHashMap();
properties.put("default.targetType", "webp");
project.setCustomProperties("ImageWriteParam", properties);
project.save();
project.unlock(); 

  

What needs to be done to recalculate the images? Output/Generation is still jpg.

Thanks!

0 Kudos

Hello Timo,

FirstSpirit caches the resolutions after they have been calculated (which is normally also desired, as otherwise the resolutions would have to be recalculated each time they are accessed). In this case, however, this leads to the resolutions still being displayed with the wrong type.

The solution is to delete the calculated resolutions. This can be done either with a repository viewer script (please contact support, as misuse could delete the entire content of the project - so I will not post the script here), or with an export/import of the project, where the option to export the automatically calculated resolutions must be explicitly disabled (during the export).

Note: When using SEO URLs, media created as webp will still be created with the existing URL (i.e. with the jpg extension). This should not be a problem and can be changed by deleting the SEO URLs from the context menu.

Best regards
Holger

Hi Holger.

I would like to request a third, more convenient way.

As we have hundreds of projects we cannot ex- and import all of them. I also do not like to use the viewer in so many projects, even to prevent support cases on your side 😉

What do you think? What are the options?

Greetings,
Daniel