Skip to main content
Kunal_Gaba_
New Participant
August 29, 2016

Image URLs

  • August 29, 2016
  • 4 replies
  • 4754 views

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. 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

4 replies

smacdonald2008
New Participant
August 29, 2016

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. 

Ashokkumar_TA
New Participant
August 29, 2016

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. 

Kunal_Gaba_
New Participant
August 30, 2016

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

kautuk_sahni
Employee
August 29, 2016

Interesting Question.

Let community answer it.

~kautuk

Kautuk Sahni