@Override public String toString() { return this.rendition.getPath() + " (" + this.width + "x" + this.height + ")"; }
OperationContext context = session.createOperationContext(); context.setRenditionFilterString("cmis:thumbnail"); CmisObject doc = session.getObjectByPath("/Sites/ren/documentLibrary/Spring Surf and OpenCMIS Integration", context); List<Rendition> renditions = doc.getRenditions(); for (Rendition rendition : renditions) { System.out.println("kind: " + rendition.getKind()); System.out.println("mimetype: " + rendition.getMimeType()); System.out.println("width: " + rendition.getWidth()); System.out.println("height: " + rendition.getHeight()); System.out.println("stream id: " + rendition.getStreamId()); }
/** * @param value DAM rendition * @return true if rendition is the original file that was uploaded initially */ private boolean isOriginalRendition(Rendition value) { return StringUtils.equals(value.getName(), ORIGINAL_FILE); }
@PostConstruct public void init() throws SlingModelsException { Asset asset = resource.adaptTo(Asset.class); if(null == asset){ return; } Rendition rendition = (asset.getRendition("plain") != null) ? asset.getRendition("plain") : asset.getOriginal(); StringWriter writer = new StringWriter(); try { IOUtils.copy(rendition.getStream(), writer, "UTF8"); this.body = writer.toString(); } catch (IOException e) { LOG.error("Error reading rendition: {}", rendition.getPath(), e); } }
/** * @return File size */ public long getFileSize() { return this.rendition.getSize(); }
asset.listRenditions().forEachRemaining(r -> renditions.put(r.getName(), r)); Rendition original = renditions.remove("original"); tabulate(folderPath, Column.rendition_count, renditions.size()); long size = original.getSize(); tabulate(folderPath, Column.original_size, size); tabulate(folderPath, Column.combined_size, size); long size = rendition.getSize(); tabulate(folderPath, Column.rendition_size, size); tabulate(folderPath, Column.combined_size, size);
/** * Add sources for HTML5 video player * @param video Video * @param media Media metadata */ protected void addSources(Video video, Media media) { Asset asset = getDamAsset(media); if (asset == null) { return; } for (VideoProfile profile : getVideoProfiles()) { com.day.cq.dam.api.Rendition rendition = profile.getRendition(asset); if (rendition != null) { video.createSource() .setType(profile.getHtmlType()) .setSrc(urlHandler.get(rendition.getPath()).buildExternalResourceUrl(rendition.adaptTo(Resource.class))); } } }
/** * @return Mime type */ public String getMimeType() { return this.rendition.getMimeType(); }
@SuppressWarnings("null") protected InputStream getInputStream() { return this.rendition.adaptTo(Resource.class).adaptTo(InputStream.class); }
Asset asset = rendition.getAsset(); String renditionName = rendition.getName(); if (isOriginal) { renditionName = asset.getName(); String metadataPath = JcrConstants.JCR_CONTENT + "/" + NN_RENDITIONS_METADATA + "/" + rendition.getName(); Resource metadataResource = asset.adaptTo(Resource.class).getChild(metadataPath); if (metadataResource != null) {
is = asset.getOriginal().getStream(); IOUtils.copy(is, fos);
/** * Get the size of the Asset (the original rendition). * * @param asset * @return */ private static long getSize(final Asset asset) { final Rendition original = asset.getOriginal(); if (original == null) { return 0; } return original.getSize(); }
newLayer.setMimeType(rendition.getMimeType());
@Override @SuppressWarnings("null") public @NotNull ValueMap getProperties() { if (this.rendition != null) { return this.rendition.getRendition().adaptTo(Resource.class).getValueMap(); } else { return ValueMap.EMPTY; } }
InputStream is = asset.getOriginal().getStream();) {
/** * Given an {@link Asset}, this method will return the first web {@link Rendition} it finds in the asset's renditions list. * * @param asset the asset for which to retrieve the web rendition * @return the rendition, if found, {@code null} otherwise */ private Rendition getAWebRendition(Asset asset) { List<Rendition> renditions = asset.getRenditions(); for (Rendition rendition : renditions) { if (rendition.getName().startsWith(DamConstants.PREFIX_ASSET_WEB)) { return rendition; } } return null; }
/** * Get the size of the Asset (the original rendition). * * @param asset * @return */ private static long getSize(final Asset asset) { final Rendition original = asset.getOriginal(); if (original == null) { return 0; } return original.getSize(); }