Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Changing the downloaded filename using Dynamic Media on AEM

Avatar

Level 2

Hi all,

We get a lot of requests from our customers to deliver assets with different, customer specific filename conventions (e.g. PRODUCTID_SHOTCODE.jpg), which isn't the name we give the files in AEM Assets. This applies to images, files etc.

 

I've gone through the Image Serving API for dynamic media (https://experienceleague.adobe.com/docs/dynamic-media-developer-resources/image-serving-api/image-se...) but can't find anything in there that suggests how to do this. Essentially, I want to be able to do something like:

 

https://s7d1.scene7.com/is/image/3m/Cat?crop=100,100,300,300&downloadFilename=croppedcat.jpg

 

This would allow us to build other integrations with our product catalogue and data syndication tools to mass download assets with the right names by default, prior to sending to customers, rather than having to download everything and then run a rename script.

 

Does anyone know if this is possible?

 

Thanks!

 

 

Paul.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi Paul,

Welcome to Adobe Community !!

URL transformation is possible when you have applied rulesets on that configured Dynamic Media account (on your AEM Assets Author)

Detailed information available here : https://experienceleague.adobe.com/docs/experience-manager-65/assets/dynamic/using-rulesets-to-trans...

In case you need example for rulesets and how they are created, please refer to this document : https://experienceleague.adobe.com/docs/dynamic-media-developer-resources/image-serving-api/image-se...

 

Note : Please test rulesets on a Dynamic Media Staging environment or a test account on your Dynamic Media Production environment.
Thanks,

Vikram Gaur

View solution in original post

3 Replies

Avatar

Correct answer by
Employee Advisor

Hi Paul,

Welcome to Adobe Community !!

URL transformation is possible when you have applied rulesets on that configured Dynamic Media account (on your AEM Assets Author)

Detailed information available here : https://experienceleague.adobe.com/docs/experience-manager-65/assets/dynamic/using-rulesets-to-trans...

In case you need example for rulesets and how they are created, please refer to this document : https://experienceleague.adobe.com/docs/dynamic-media-developer-resources/image-serving-api/image-se...

 

Note : Please test rulesets on a Dynamic Media Staging environment or a test account on your Dynamic Media Production environment.
Thanks,

Vikram Gaur

Avatar

Level 2

Thank you @Vikram_Gaur_ , that's really helpful! If I'm reading it correctly, this says that we could supply a specific URL parameter and use that to reformat the response URL, e.g. with the example

 

https://s7d1.scene7.com/is/image/3m/Cat?crop=100,100,300,300&downloadFilename=croppedcat.jpg

 

 

<rule>
   <expression>#CLEVER_REGEX_TO_FIND_"downloadFilename"_AND_PULL_QUERY_PARAMETER_"croppedcat.jpg"#</expression>
   <substitution>#REPLACE_FILENAME_WITH_"croppedcat.jpg"#</substitution>
</rule>

Is that right, i.e. we can program the rulesets to do something specific if we deliver a specific URL structure?

 

Thanks,

 

 

Paul.

Avatar

Employee Advisor

Hi Paul

That looks good.

You just have to create a "CLEVER_REGEX" now.

For example myCat/myImage/small would translate to myCat/smallTemplate?src=myCat/myImage 

 

Using this rule : 

<rule>
   <expression>([^/]+)/(small|medium|large)$</expression>
   <substitution>$2Template?src=sample/$1</substitution>
</rule>

 

Thanks,

Vikram Gaur