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.

Image URLs

Avatar

Employee Advisor

What are the pros and cons of using absolute image paths vs the paths relative to the current page node (What image component uses. )

Example -   /content/dam/site/asset/jcr:content/renditions/dam_web.png  (This uses direct DAM URL to render the image)

                            OR

                   /content/site/en_US/test/_jcr_content/par/image.img.png/1472122582094.png (This uses Image servlet to render the image)

If we have a requirement to create an image component to fetch custom renditions then which URL should we choose ? Is there any benefit related to flushing of dispatcher and browser caches with the second URL and that is why AEM image component uses this URL strategy. 

4 Replies

Avatar

Administrator

Interesting Question.

Let community answer it.

~kautuk



Kautuk Sahni

Avatar

Level 2

Think the key difference is with reusing the same asset in other pages / sites.

Images maintained under  /content/dam/  can be reused across multiple pages. Typically these image assets is maintained by separate team. Also only the images under  /content/dam/ show up on the damadmin console for managing. 

Images under the page path are typically local to the page and are not intended to be reused in other pages. 

Avatar

Employee Advisor

Then why out of the box image component uses URLs relative to the current page ? 

Avatar

Level 10

The only way i see that it makes sense to use a servlet to render an image is when you want to dynamically change the URL based on various run-time conditions that can be evaluated by the servlet.