Goal
AEM Cloud Version : 2021.4.5226.20210427T070726Z-210325 (April 27, 2021)
Maximum asset size for uploads from AEM UI can be configured by overlaying /libs/dam/gui/content/assets/jcr:content/actions/secondary/create/items/fileupload@sizeLimit in /apps, however if the requirement is to configure limit per asset type (eg. jpg, png, mp4 etc.) the following extension could be useful....
1) Create a custom widget /apps/eaem-cs-restrict-assets-size/dam-tools/textfield/textfield.jsp to read the values from config resource /conf/global/settings/dam/eaem-dam-config
<%@include file="/libs/granite/ui/global.jsp" %>
<%@page session="false"
import="com.adobe.granite.ui.components.AttrBuilder,
com.adobe.granite.ui.components.Config,
com.adobe.granite.ui.components.Tag" %>
<%
Config cfg = cmp.getConfig();
String CONFIG_RES = "/conf/global/settings/dam/eaem-dam-config";
Resource configRes = resourceResolver.getResource(CONFIG_RES);
String name = cfg.get("name", String.class);
String value = "";
if(configRes != null){
value = configRes.getValueMap().get(name, String.class);
}
if(value == null){
value = cfg.get("defaultValue", String.class);
}
if(value == null){
value = "";
}
Tag tag = cmp.consumeTag();
AttrBuilder attrs = tag.getAttrs();
cmp.populateCommonAttrs(attrs);
attrs.add("name", name);
String fieldLabel = cfg.get("fieldLabel", String.class);
String fieldDesc = cfg.get("fieldDescription", String.class);
%>
<%=fieldDesc%>
2) Create the tools navigation /apps/cq/core/content/nav/tools/eaem-dam-tools/eaem-dam-config
?
1
2
3
4
5
6
7
8
9
3) Create the configuration page /apps/eaem-cs-restrict-assets-size/dam-tools/eaem-dam-config saving max upload limits to /conf/global/settings/dam/eaem-dam-config accessed using Tools > EAEM Configuration > EAEM Confi