dam thumbnail servlet question | Community
Skip to main content
Dterner
Level 2
October 16, 2015
Solved

dam thumbnail servlet question

  • October 16, 2015
  • 4 replies
  • 3499 views

Hi,

I know that I can access the thumbnails of assets created in the dam via the following servlet:

/content/dam/images/image.jpg.thumb.100.140.png

However when I tried uploading a custom rendition following the same naming convention ie: cq5dam.thumbnail.200.100.png 

I am unable to access it using the same method. Not sure what I'm missing.

Thanks,

Dmitry

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 Sham_HC

you need to write an custom servlet to handle this case

4 replies

Level 8
October 16, 2015

The URL to your rendition should look like this:

/content/dam/images/image.jpg/jcr:content/renditions/cq5dam.thumbnail.100.140.png (assuming that 100 x 140 is the size you're looking for)

Sham_HC
Sham_HCAccepted solution
Level 10
October 16, 2015

you need to write an custom servlet to handle this case

Dterner
DternerAuthor
Level 2
October 16, 2015

Hi Lee,

Thanks for the reply, I know that method works, but the latest antisamy library will strip anything with jcr:content in its path from text fields where I may want to use this rendition. So I was hoping to use the other way to get at it so far with no luck.

Level 8
October 16, 2015

So this was an interesting exercise in reverse engineering. I believe I have figured out - the naming conventions are 100 clear, but the key is following accurate naming conventions. If you want to access rendition with using the thumb selection (which maps to the com.day.cq.wcm.core.impl.servlets.ThumbnailServlet) you must:

  1. Start the name of your rendition with cq5dam.thumbnail - if you don't use that naming convention the servlet will not find your rendition. 
  2. You name must also follow the convention of int1.int2 - those integers don't necessarily need to match size of your image - but they must be integers and there must be two of them. 
  3. You must reverse order of the selectors in the name of the rendition. So for example if you rendition is named cq5dam.thumbnail.200.100.png your path to the servlet will be /content/dam/images/image.jpg.thumb.100.200.png. 

Any deviation from those naming conventions and the thumbnail servlet won't work. The full path that goes down through jcr:content works no matter what you rendition naming convention, but thumbnail servlet requires the naming conventions above. You can see that naming convention in the out of the box examples:

I don't know if the flipping of the order is intentional or a bug, but it is consistent.