Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

How to upload custom thumbnail and renditions using JAVA servlet

Avatar

Level 2

In DamAdmin, select an asset, right click open it , there we have an option to upload custom thumbnail and renditions.

Same thing I need to do using java servlet for any type of asset.

Any help will be appreciated.

Thanks in Advance!!

Question.png

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi Satya

      You can add renditions to any image using AssetManager/Asset API . Please refer the below API for more help Asset ("The Adobe AEM Quickstart and Web Application.")

1380824_pastedImage_3.png

    A sample code might help Java Code Example

1380814_pastedImage_2.png

Thanks

Veena

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi Satya

      You can add renditions to any image using AssetManager/Asset API . Please refer the below API for more help Asset ("The Adobe AEM Quickstart and Web Application.")

1380824_pastedImage_3.png

    A sample code might help Java Code Example

1380814_pastedImage_2.png

Thanks

Veena

Avatar

Level 2

Also for custom thumbnail we can use RenditionMaker or Asset Handler.

By RenditionMaker, we can associate an Asset "X" with Asset "Y" as a thumbnail.

// Create the Rendition Template for thumbnail

RenditionTemplate[] templates = createRenditionTemplates(tempThumbnailAsset);

// Generate thumbnail

renditionMaker.generateRenditions(asset, templates);

private RenditionTemplate[] createRenditionTemplates(Asset tempThumbnailAsset) {

        ThumbnailConfig[] thumbnails = new ThumbnailConfig[1];

        ThumbnailConfig thumbnail = new ThumbnailConfigImpl(48,48,false);

      

        RenditionTemplate[] templates = new RenditionTemplate[thumbnails.length];

        for (int i = 0; i < thumbnails.length; i++) {

            ThumbnailConfig thumb = thumbnails[i];

            templates[i] = renditionMaker.createThumbnailTemplate(tempThumbnailAsset,thumb.getWidth(),

                                thumb.getHeight(),thumb.doCenter());

        }

        return templates;

}