Skip to content

Instantly share code, notes, and snippets.

@markdaugherty
Last active April 24, 2020 13:51
Show Gist options
  • Save markdaugherty/fe6ddf3fe766ffed5db6062bcc6ea673 to your computer and use it in GitHub Desktop.
Save markdaugherty/fe6ddf3fe766ffed5db6062bcc6ea673 to your computer and use it in GitHub Desktop.
AEM Cacheable Renditions Example Usage
import com.avionos.aem.assets.cacheablerenditions.api.CacheableRendition;
import com.day.cq.dam.api.Asset;
// get cacheable rendition from rendition
final CacheableRendition cacheableRendition = resourceResolver
.getResource("/content/dam/avionos/images/one.png")
.adaptTo(Asset.class)
.getRendition("cq5dam.thumbnail.48.48.png")
.adaptTo(CacheableRendition.class);
assertEquals("/content/dam/avionos/images/one.png.rendition/cq5dam.thumbnail.48.48.png",
cacheableRendition.getPath());
// get cacheable rendition from resource
final CacheableRendition cacheableRendition = resourceResolver
.getResource("/content/dam/avionos/images/one.png/jcr:content/renditions/cq5dam.thumbnail.48.48.png")
.adaptTo(CacheableRendition.class);
assertEquals("/content/dam/avionos/images/one.png.rendition/cq5dam.thumbnail.48.48.png",
cacheableRendition.getPath());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment