Expand my Community achievements bar.

SOLVED

Getting custom rendition programatically

Avatar

Adobe Champion

I have a custom rendition created for jpeg image in AEM and programmatically I am trying to get that rendition as a stream.

I can see this rendition exist in the image node, but when I try to get it as input steam , I get null pointer exception.

 

final Asset asset = DamUtil.resolveToAsset(resource);
InputStream in = asset.getRendition("cq5dam.web.300.300.jpeg").getStream();

 

Same code works for png rendition.

final Asset asset = DamUtil.resolveToAsset(resource);
InputStream in = asset.getRendition("cq5dam.thumbnail.319.319.png").getStream();

 

Anyone know why is the difference and why it is failing for jpeg image?

1 Accepted Solution

Avatar

Correct answer by
Level 4

Please check if that particular rendition is available for that asset by checking via crxde.

 

View solution in original post

2 Replies

Avatar

Correct answer by
Level 4

Please check if that particular rendition is available for that asset by checking via crxde.

 

Avatar

Adobe Champion

One of the images in the result didn't have the rendition. Thanks @thatsmeadarsh