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.
SOLVED

Downloading an image from dynamic media

Avatar

Adobe Champion


If I have a dynamic media image sitting in this url, for eg: 

https://<dynamicmediaurl>/imagename?$test-Web-1005x257$

 

how can I download this image as inputstream programmatically?

does anyone have any sample code?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Yes i meant the URL to Dynamic Media image like the one below from our site. The image is delivered from DM server. We are in DM Hybrid,

 

https://siliconlabs-h.assetsadobe.com/is/image//content/dam/siliconlabs/images/community/blog/fg25-g... 

 

Zip Code Examples: https://mkyong.com/java/how-to-compress-files-in-zip-format/

Create the Zip and store in DAM as Asset for later download.

View solution in original post

5 Replies

Avatar

Community Advisor

You can create URL instance with the path and and create Input Stream. What is your end goal ?

 

URL url = new URL(imageUrl);
InputStream is = url.openStream();

 

Avatar

Adobe Champion

@Saravanan_Dharmaraj  Thanks for your comment. My end goal is to create a zip of a set of changed images with a particular dynamic media rendition. 
The image url you mentioned above is dynamic media image url right, which will be different from the dam image url?

Avatar

Adobe Champion

@Saravanan_Dharmaraj  Could you please help me understand what you mean by package it? Do you mean create a zip? I am good with the zipping part. But i was looking for the scene7 image download part a stream. In your code above image url is scene7 image url which is different from dam image url right?

 

Avatar

Correct answer by
Community Advisor

Yes i meant the URL to Dynamic Media image like the one below from our site. The image is delivered from DM server. We are in DM Hybrid,

 

https://siliconlabs-h.assetsadobe.com/is/image//content/dam/siliconlabs/images/community/blog/fg25-g... 

 

Zip Code Examples: https://mkyong.com/java/how-to-compress-files-in-zip-format/

Create the Zip and store in DAM as Asset for later download.