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 Asset's Renditions break asset in Dispatcher cache

Avatar

Level 2

The problem is that say you have a video asset in the DAM,  http://mysite.com/content/dam/mysite/resources/videos/Patient-Centered-Approach.mp4

I am using an HTML5 video player (jwplayer). It has two properties, the video file url and the url of the "poster" (“rendition” or “thumbnail”) image. The rendition technically is stored as a child node of the video in the JCR repository. So the full url to the rendition is:

http://mysite.com/content/dam/mysite/resources/videos/Patient-Centered-Approach.mp4/jcr:content/rend...

The problem is that “Patient-Centered-Approach.mp4” cannot be both a file and a folder in the dispatcher cache at the same time, so if the image is requested first then the dispatcher will create a folder named “Patient-Centered-Approach.mp4” with a sub-folder named “jcr:content” down to the PNG image.

If the video is requested before the PNG then the video works, but the PNG will not (because “Patient-Centered-Approach.mp4” is a file in the cache not a folder).

This cannot be an unusual scenario. How is this usually handled?

1 Accepted Solution

Avatar

Correct answer by
Level 8

The simplest solution is to change how you refer to the rendition. Instead of 

http://mysite.com/content/dam/mysite/resources/videos/Patient-Centered-Approach.mp4/jcr:content/rend...

Use

http://mysite.com/content/dam/mysite/resources/videos/Patient-Centered-Approach.mp4.thumb.405.704.pn...

If that doesn't work you might want to try reversing the numbers - 704.405 - normally the thumb selector scripts wants them the reverse of now the rendition is named, however if you are using any custom logic in your rendition creation then it might go the other way. 

View solution in original post

6 Replies

Avatar

Correct answer by
Level 8

The simplest solution is to change how you refer to the rendition. Instead of 

http://mysite.com/content/dam/mysite/resources/videos/Patient-Centered-Approach.mp4/jcr:content/rend...

Use

http://mysite.com/content/dam/mysite/resources/videos/Patient-Centered-Approach.mp4.thumb.405.704.pn...

If that doesn't work you might want to try reversing the numbers - 704.405 - normally the thumb selector scripts wants them the reverse of now the rendition is named, however if you are using any custom logic in your rendition creation then it might go the other way. 

Avatar

Former Community Member
 

If you don't want to force your client to do a 301 redirect for each image you can just do a Pass-thru but unfortunately the Dispatcher still won't cache the original rendition since it doesn't have a file extension.  Below I have a RewriteCond because the RewriteRule would catch requests to the cq5dam.thumbnail.48.48.png so we want those to be skipped but we want to catch all the other images.

RewriteCond %{REQUEST_URI} !.*jcr:content.* RewriteRule ^/content/dam/imagepath/(.*)\.(gif|png|jpg|jpeg)$ /content/dam/imagepath/$1.$2/jcr:content/renditions/original [PT,NC,L]

However if you were dealing with ONLY IMAGES I think a better solution if you want to cache the files is to pass the web rendition in the RewriteRule

RewriteCond %{REQUEST_URI} !.*jcr:content.* RewriteRule ^/content/dam/imagepath/(.*)\.(gif|png|jpg|jpeg)$ /content/dam/imagepath/$1.$2/jcr:content/renditions/cq5dam.web.1280.1280.jpeg [PT,NC,L]

Avatar

Level 1

Hi,

I recently stumbled over a similar problem... I have no final solution yet. You may want to try to create a Rewrite-Rule in your webserver, sending a 301 from

http://mysite.com/content/dam/mysite/resources/videos/Patient-Centered-Approach.mp4

to

http://mysite.com/content/dam/mysite/resources/videos/Patient-Centered-Approach.mp4/jcr:content/rend...

as an intermediate workaround. This will keep "Patient-Centered-Approach.mp4" uncached and the dispatcher my use it to create a directory. This works for images, though i have not tested if movies are also available at "renditions/original".

Regards  achim

Avatar

Level 8

That URL would work for an image asset - but the asset you are referencing is a mp4 - only thumbnails are created for an MP4. That URL pattern should work with an image asset.