Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

dam thumbnail servlet question

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Level 10

you need to write an custom servlet to handle this case

View solution in original post

4 Replies

Avatar

Level 8

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)

Avatar

Correct answer by
Level 10

you need to write an custom servlet to handle this case

Avatar

Level 2

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.

Avatar

Level 8

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.