How to upload custom thumbnail and renditions using JAVA servlet | Community
Skip to main content
satyambansal
Level 2
Dec 26, 2017 11:00 AM UTC
Solved

How to upload custom thumbnail and renditions using JAVA servlet

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!!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
VeenaVikraman
VeenaVikramanAccepted solution
New Participant
Dec 26, 2017 2:04 PM UTC

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.")

    A sample code might help Java Code Example

Thanks

Veena

2 replies

satyambansal
Level 2
Jan 2, 2018 6:01 PM UTC

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;

}

Translate
VeenaVikraman
VeenaVikramanAccepted solution
New Participant
Dec 26, 2017 2:04 PM UTC

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.")

    A sample code might help Java Code Example

Thanks

Veena

Translate