@Override public String toString() { return this.rendition.getPath() + " (" + this.width + "x" + this.height + ")"; }
@Override public int hashCode() { return new HashCodeBuilder() .append(this.rendition.getPath()) .hashCode(); }
@Override public String getPath() { if (this.rendition != null) { return this.rendition.getRendition().getPath(); } else { return null; } }
@Override public int hashCode() { return new HashCodeBuilder() .append(this.getRendition().getPath()) .append(width) .append(height) .append(cropDimension) .append(rotation) .hashCode(); }
@Override public int hashCode() { return new HashCodeBuilder() .append(this.getRendition().getPath()) .append(width) .append(height) .hashCode(); }
@Override public boolean equals(Object obj) { if (obj == null || obj.getClass() != this.getClass()) { return false; } VirtualTransformedRenditionMetadata other = (VirtualTransformedRenditionMetadata)obj; return new EqualsBuilder() .append(this.getRendition().getPath(), other.getRendition().getPath()) .append(this.width, other.width) .append(this.height, other.height) .append(this.cropDimension, other.cropDimension) .append(this.rotation, other.rotation) .build(); }
@Override public boolean equals(Object obj) { if (obj == null || obj.getClass() != this.getClass()) { return false; } VirtualRenditionMetadata other = (VirtualRenditionMetadata)obj; return new EqualsBuilder() .append(this.getRendition().getPath(), other.getRendition().getPath()) .append(this.width, other.width) .append(this.height, other.height) .build(); }
@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); } }
/** * @param contentDispositionAttachment Force content disposition download header. * @return Media path (not externalized) */ public String getMediaPath(boolean contentDispositionAttachment) { if (contentDispositionAttachment) { return RenditionMetadata.buildMediaPath(getRendition().getPath() + "." + MediaFileServlet.SELECTOR + "." + MediaFileServlet.SELECTOR_DOWNLOAD + "." + MediaFileServlet.EXTENSION, getFileName()); } else { // use "deep URL" to reference rendition directly // do not use Asset URL for original rendition because it creates conflicts for dispatcher cache (filename vs. directory for asset resource name) return RenditionMetadata.buildMediaPath(this.rendition.getPath() + ".", getFileName()); } }
@Override public String getMediaPath(boolean contentDispositionAttachment) { return RenditionMetadata.buildMediaPath(getRendition().getPath() + "." + ImageFileServlet.SELECTOR + "." + getWidth() + "." + getHeight() + (contentDispositionAttachment ? "." + MediaFileServlet.SELECTOR_DOWNLOAD : "") + "." + MediaFileServlet.EXTENSION, getFileName()); }
String renditionUrl = "../../../../.." + rendition.getPath();
@Override public String getMediaPath(boolean contentDispositionAttachment) { return RenditionMetadata.buildMediaPath(getRendition().getPath() + "." + ImageFileServlet.SELECTOR + "." + getWidth() + "." + getHeight() + "." + (this.cropDimension != null ? this.cropDimension.getCropString() : "-") + (this.rotation != null ? "." + this.rotation : "") + (contentDispositionAttachment ? "." + MediaFileServlet.SELECTOR_DOWNLOAD : "") + "." + MediaFileServlet.EXTENSION, getFileName()); }
/** * 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))); } } }
renditionWidth = rendition.getWidth(); LOGGER.debug("Found rendition {} with width {}px; assuming the cropping rectangle was calculated using this " + "rendition.", webRendition.getPath(), renditionWidth); resizeWidth, extension)); if (rendition != null) { LOGGER.debug("Found rendition {} with a width equal to the resize width ({}px); rendering.", rendition.getPath(), resizeWidth); stream(response, rendition.getStream(), imageType, imageName);
final Resource renditionResource = request.getResourceResolver().getResource(rendition.getPath());
final Resource renditionResource = request.getResourceResolver().getResource(rendition.getPath());