Reputation: 144
For my video assets, I want to set my own thumbnails by adding a new rendition on assets. I am able to retrieve all the renditions uploaded using the getRenditions method however, I want to retrieve the path for the latest uploaded rendition only.
Upvotes: 1
Views: 456
Reputation: 144
My suggestion is to iterate Asset's Renditions and find the latest one, looking at "jcr:lastModified" property, here is untested code sample:
Rendition lastRendition = null;
Date lastDate = null;
for (Rendition r : asset.getRenditions()) {
Date date = r.getProperties().get(JcrConstants.JCR_LASTMODIFIED);
if (lastDate == null || date.after(lastDate)) {
lastRendition = r;
lastDate = date;
}
}
Upvotes: 1