Expand my Community achievements bar.

SOLVED

Dynamic media - asset properties

Avatar

Level 2

hi all,

 

I'm trying to get image DPI from dynamic media using java api

It is possible using

https://scene7.com/is/image/client/image?req=props,json

 

I need to get image props using scene7 api, think I found api that I need but need code examples, can't figure out from the doc how to create proper call.

This should be the method

getAsset​(java.lang.String assetHandle, java.lang.String[] responseFields, java.lang.String[] excludeFields, S7Config s7Config)

from 

https://developer.adobe.com/experience-manager/reference-materials/cloud-service/javadoc/com/day/cq/...

 

In the response I'll get Scene7Asset

https://developer.adobe.com/experience-manager/reference-materials/cloud-service/javadoc/com/day/cq/...

 

and further I can use  getAssetProperties to get info that I need.

 

Thank you

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

BTW, Core component makes the call to req=set,json to get the smart crop rendition in client side before delivering the image in the html. You can do props calls incase if you are doing it from front end. 

https://github.com/adobe/aem-core-wcm-components/blob/main/content/src/content/jcr_root/apps/core/wc...

 

View solution in original post

6 Replies

Avatar

Community Advisor

@nbg19a You can reference the Interface just like you are doing for other services in AEM

 

@Reference
private Scene7Service s7service;

Same for S7Config too and then make the method calls. Make sure you have the DM S7 configured in the AEM instance the code is running otherwise s7service  returns null. 

 

Avatar

Correct answer by
Community Advisor

BTW, Core component makes the call to req=set,json to get the smart crop rendition in client side before delivering the image in the html. You can do props calls incase if you are doing it from front end. 

https://github.com/adobe/aem-core-wcm-components/blob/main/content/src/content/jcr_root/apps/core/wc...

 

Avatar

Level 2

Thanks,

 

major problem I'm facing in this moment,

 

I manage to get results back from searchAssetsByFilename method

scene7Service.searchAssetsByFilename("my-dm-folder", true, true, "my-dm-test-image.png", s7config);

 

but what ever combination I tried for "getAsset" method

scene7Service.getAsset("my-dm-test-image.png", new String[] {}, new String[] {}, s7config);

 

I'm getting null in response.

Avatar

Community Advisor

@nbg19a  getAsset method looks for asset handle not the name. 

Try to get the scene7ID like below from asset metadata node and pass the value and see if you are getting the result

 

Saravanan_Dharmaraj_0-1700492122184.png

 

Avatar

Level 2

tried that as well, no luck

 

Avatar

Administrator

@nbg19a Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni