Highlighted

Child node path in javascript

Avatar

Avatar

varuns46785756

Avatar

varuns46785756

varuns46785756

16-03-2017

Hi,

I have images in dam in particular path.  like: content/dam/myproject/stateimage/image1.jpg....content/dam/myproject/stateimage/image2.jpg....

I am getting path through page property upto: content/dam/myproject/stateimage.

I am trying to iterate all the images path under this location(content/dam/myproject/stateimage.) in my component in javascript( serevr side script).Please suggest

 

 

Regards

Replies

Highlighted

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

16-03-2017

If you want to use script to iterate through DAM Assets - much better to use JSP than JS. 

See" 

https://helpx.adobe.com/experience-manager/using/aem-dam-image-components.html

Why are you using JS to try and read JCR nodes? 

Highlighted

Avatar

Avatar

Runal_Trivedi

MVP

Avatar

Runal_Trivedi

MVP

Runal_Trivedi
MVP

17-03-2017

you should either have your JSP write the child assets in that folder as data attribute and you can use it then in your JS as needed.

OR

You can write a servlet to return all the child asset paths under your folder, make the Ajax call from JS to the servlet and use the response array as you want.

I will suggest you to take the servlet route, as with JSP once your page gets cached, then you won't be able to get the updated list of assets on any new addition of that asset under that dam folder.

~ Runal

Highlighted

Avatar

Avatar

varuns46785756

Avatar

varuns46785756

varuns46785756

17-03-2017

Hi

smacdonald2008 wrote...

If you want to use script to iterate through DAM Assets - much better to use JSP than JS. 

See" 

https://helpx.adobe.com/experience-manager/using/aem-dam-image-components.html

Why are you using JS to try and read JCR nodes? 

 

Hi Scott,

 

I am using slightly

My requirement is:  . I have one hero image component and : I am displaying different images on each page load and all the images present in dam.

I have asset folder name same as page name in dam.I am getting page path and trying to append the image in page path: like:

 page path :/content/myproject/mypage.html

dam path: /content/dam/myproject/mypage/myimage1.jpg,/content/dam/myproject/mypage/myimage2.jpg

trying to get the image path by server side script.

Regards,

Highlighted

Avatar

Avatar

varuns46785756

Avatar

varuns46785756

varuns46785756

22-03-2017

Hi,

Please suggest.

 

 

Regards,

Highlighted

Avatar

Avatar

Feike_Visser1

Employee

Avatar

Feike_Visser1

Employee

Feike_Visser1
Employee

22-03-2017

Are the image-paths stored on the hero-image component?

Highlighted

Avatar

Avatar

varuns46785756

Avatar

varuns46785756

varuns46785756

22-03-2017

All images stored in dam , at: dam path: /content/dam/myproject/mypage

images  dam path: /content/dam/myproject/mypage/myimage1.jpg,

                                     /content/dam/myproject/mypage/myimage2.jpg

 I need to iterate all images from this location  /content/dam/myproject/mypage to my component

 

 

Regards,