How to programmatically set image path in AEM6.4 Dynamic media component

Avatar

Avatar
Springboard
Level 2
seenivasaragava
Level 2

Like

1 like

Total Posts

23 posts

Correct reply

1 solution
Top badges earned
Springboard
Give Back 3
Give Back
Ignite 3
Ignite 1
View profile

Avatar
Springboard
Level 2
seenivasaragava
Level 2

Like

1 like

Total Posts

23 posts

Correct reply

1 solution
Top badges earned
Springboard
Give Back 3
Give Back
Ignite 3
Ignite 1
View profile
seenivasaragava
Level 2

28-02-2019

Hi All,

I have component lets say xyz and I'm including sly-resource "Dynamic Media" component into page like mentioned below,

in XYZ .html:-

<sly data-sly-resource="${ 'dynamic-media' @ resourceType='dam/components/scene7/dynamicmedia'}"/>

It will add the node under  "/content/dam/customwebsite/xyz" as "/content/dam/custom/xyz/dynamic-media" only when we drag and drop an image into it.(into dynamic media component")

I would like to set a image programmatically

Assume before including the dynamic media component I have a image path like

"xyz.imagePath"   (xyz is a java sling model for my xyz component)

is it possible somehow pass this image path programmatically into dynamic media component? Can some one help me?

Thanks

Seeni

Replies

Avatar

Avatar
Springboard
Level 7
Prince_Shivhare
Level 7

Likes

122 likes

Total Posts

403 posts

Correct reply

65 solutions
Top badges earned
Springboard
Establish
Give Back 100
Boost 100
Validate 1
View profile

Avatar
Springboard
Level 7
Prince_Shivhare
Level 7

Likes

122 likes

Total Posts

403 posts

Correct reply

65 solutions
Top badges earned
Springboard
Establish
Give Back 100
Boost 100
Validate 1
View profile
Prince_Shivhare
Level 7

28-02-2019

Not sure why you need to use Sling models. Can you please more clarify the requirement?

Drag and drop is best thing in AEM.

Avatar

Avatar
Springboard
Level 2
seenivasaragava
Level 2

Like

1 like

Total Posts

23 posts

Correct reply

1 solution
Top badges earned
Springboard
Give Back 3
Give Back
Ignite 3
Ignite 1
View profile

Avatar
Springboard
Level 2
seenivasaragava
Level 2

Like

1 like

Total Posts

23 posts

Correct reply

1 solution
Top badges earned
Springboard
Give Back 3
Give Back
Ignite 3
Ignite 1
View profile
seenivasaragava
Level 2

28-02-2019

Ok.Forget about the sling model now.

Lets say I have a product Object coming from E-Commerce. That object has product name, description and product image path like mentioned below.

product {

name: "Shirt", description:"men's shirt" , imagePath: "/content/dam/retail/shits/shirt1.jpg"

}

In my component HTL i can display

Name: ${product.name}

Description: ${product.description}

Product Name:   <---   here I need dynamic media component to be included with the product image --->

So here I can't request author to drag and drop the product images as all the details should come from commerce (including image)

Avatar

Avatar
Springboard
Level 7
Prince_Shivhare
Level 7

Likes

122 likes

Total Posts

403 posts

Correct reply

65 solutions
Top badges earned
Springboard
Establish
Give Back 100
Boost 100
Validate 1
View profile

Avatar
Springboard
Level 7
Prince_Shivhare
Level 7

Likes

122 likes

Total Posts

403 posts

Correct reply

65 solutions
Top badges earned
Springboard
Establish
Give Back 100
Boost 100
Validate 1
View profile
Prince_Shivhare
Level 7

28-02-2019

In this case, you will have to first upload the images in same path with name in your DAM.

then Accordingly give the service call path where you want the image to be placed.

in this condition, people who are uploading the images, they need to make sure about the path and image name.

Because you are calling image path from service call, then I don't think drag n drop will work here.

~ Prince