Fetching thumbnail image using JCR API | Community
Skip to main content
pavan_kumar_k
Level 2
October 16, 2015
Solved

Fetching thumbnail image using JCR API

  • October 16, 2015
  • 3 replies
  • 1996 views

Hi All,

Using JCR API i want to fetch the value of thumbnail image of a Asset. 

Purpose.

I am trying to display the thumbnail image of a Book in the main page and on click of it i will display the complete details including the main image  of the Book.

 

I tried to fetch the data from under imagenode/rendition folder.

 

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.
Best answer by Ove_Lindström

Try:

Resource resource = resourceResolver.getResource("/content/dam/Rental/prod1.gif");

Notice the / in the beginning of the resource path.

/Ove

3 replies

pavan_kumar_k
Level 2
October 16, 2015

Tried in the following way

       ResourceResolver resourceResolver = resolverFactory.getAdministrativeResourceResolver(null);
        Resource resource = resourceResolver.getResource("content/dam/Rental/prod1.gif");
        Asset asset = resource.adaptTo(Asset.class);
        Rendition thumb = asset.getRendition("cq5dam.thumbnail.48.48.png");

 

getting a null pointer exception in line 3 (Asset asset = resource.adaptTo(Asset.class);)

Image  is available in the Asset able to access the metadata using JCR API.

Ove_LindströmAccepted solution
Level 6
October 16, 2015

Try:

Resource resource = resourceResolver.getResource("/content/dam/Rental/prod1.gif");

Notice the / in the beginning of the resource path.

/Ove