Expand my Community achievements bar.

AEM 6550 - Extend AEM Asset Picker Card View to select Image Smart Crops and Video Dynamic Renditions | AEM Community Blog Seeding

Avatar

Administrator

BlogImage.jpg

AEM 6550 - Extend AEM Asset Picker Card View to select Image Smart Crops and Video Dynamic Rendition... by Sreekanth Choudry Nalabotu

Abstract

Solution
1) Login to CRXDE Lite (http://localhost:4502/crx/de), create folder /apps/eaem-asset-selector-card-show-dyn-renditions

2) Create the following nt:file /apps/eaem-asset-selector-card-show-dyn-renditions/smart-crop-renditions/smart-crop-renditions.jsp to return the smart crop renditions of an image as JSON

<%@include file="/libs/granite/ui/global.jsp"%>

<%@page session="false"
import="java.util.Iterator,
org.apache.sling.commons.json.JSONObject,
com.adobe.granite.ui.components.Config,
com.adobe.granite.ui.components.Tag"%>
<%@ page import="com.adobe.granite.ui.components.ds.ValueMapResource" %>

<%
Config cfg = cmp.getConfig();
ValueMap dynVM = null;

JSONObject dynRenditions = new JSONObject();
Resource dynResource = null;

response.setContentType("application/json");

for (Iterator items = cmp.getItemDataSource().iterator(); items.hasNext();) {
JSONObject dynRendition = new JSONObject();

dynResource = items.next();

dynVM = dynResource.getValueMap();

String name = String.valueOf(dynVM.get("breakpoint-name"));

dynRendition.put("type", "IMAGE");
dynRendition.put("name", name);
dynRendition.put("image", dynVM.get("copyurl"));
dynRendition.put("url", dynVM.get("copyurl"));

dynRenditions.put(name, dynRendition);
}

dynRenditions.write(response.getWriter());
%>


3) Set the datasource for Image Smart Crops /apps/eaem-asset-selector-card-show-dyn-renditions/smart-crop-renditions/renditions/datasource@sling:resourceType = dam/gui/components/s7dam/smartcrop/datasource



4) Create the following nt:file /apps/eaem-asset-selector-card-show-dyn-renditions/video-dyn-renditions/video-dyn-renditions.jsp to return the encodes of a video as JSON

Read Full Blog

AEM 6550 - Extend AEM Asset Picker Card View to select Image Smart Crops and Video Dynamic Rendition...

Q&A

Please use this thread to ask the related questions.



Kautuk Sahni
Topics

Topics help categorize Community content and increase your ability to discover relevant content.

0 Replies