DAM Asset's Renditions break asset in Dispatcher cache | Community
Skip to main content
dnelson42
Level 2
October 16, 2015
Solved

DAM Asset's Renditions break asset in Dispatcher cache

  • October 16, 2015
  • 6 replies
  • 3462 views

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/renditions/cq5dam.thumbnail.704.405.png

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?

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 PaulMcMahon

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/renditions/cq5dam.thumbnail.704.405.png

Use

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

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. 

6 replies

PaulMcMahonAccepted solution
Level 8
October 16, 2015

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/renditions/cq5dam.thumbnail.704.405.png

Use

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

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. 

October 16, 2015
 

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]
aschermuly
October 16, 2015

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/renditions/original

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

rodl56535890
February 5, 2016
Level 8
February 5, 2016

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.