Last active
April 24, 2020 13:51
-
-
Save markdaugherty/fe6ddf3fe766ffed5db6062bcc6ea673 to your computer and use it in GitHub Desktop.
AEM Cacheable Renditions Example Usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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