rendition = asset.getOriginal();
}
final Resource renditionResource = request.getResourceResolver().getResource(rendition.getPath());
final Image image = new Image(resource);
image.set(Image.PN_REFERENCE, renditionResource.getPath());
return image;
} else if (DamUtil.isRendition(resource)
|| ResourceUtil.isA(resource, JcrConstants.NT_FILE)
|| ResourceUtil.isA(resource, JcrConstants.NT_RESOURCE)) {
// For renditions; use the requested rendition
final Image image = new Image(resource);
image.set(Image.PN_REFERENCE, resource.getPath());
return image;
} else if (page != null) {
if (ResourceUtil.isA(resource, NameConstants.NT_PAGE)
|| StringUtils.equals(resource.getPath(), page.getContentResource().getPath())) {
// Is a Page or Page's Content Resource; use the Page's image resource
return new Image(page.getContentResource(), "image");
} else {
return new Image(resource);
}
}
return new Image(resource);
}