我在aem对话框中使用了html5smartimage。下面是我在dialog.xml中添加的代码。
<image
jcr:primaryType="cq:Widget"
xtype="html5smartimage"
name="./imgFile"
fieldLabel="Image"
style="border: 2px dashed #ccc;"
height="200"
ddGroups="[media]"
fieldDescription="To use a customized icon please upload it to the dam and add it here."
allowUpload="{Boolean}false"
requestSuffix=".img.png"
renditionSuffix="/_jcr_content/renditions/original"
cropParameter="./imageCrop"
fileNameParameter="./fileName"
fileReferenceParameter="./fileReference"
rotateParameter="./imageRotate" />我在组件中添加了这些代码行,但仍然得到“没有数据”。我可以很好地拖放图像,但阅读它似乎是唯一的问题
<sly data-sty-test.imgFileObj="${properties.imgFile}"></sly>
<div data-sly-test="${!imgFileObj}">
theres no data
</div>
<div data-sly-test="${imgFileObj}">
theres is data
</div>我到处都找过了,但一无所获。因此,在这方面的任何帮助都将不胜感激。此外,最终目标是获得图像的url。
发布于 2018-03-22 18:13:21
html5smartimage不会通过"name“属性保存数据。它支持许多设置,因此根据映像的配置方式,您可以期望以不同的方式保存数据。
如果将图像拖放到小部件中,则会使用与"fileReferenceParameter“关联的属性名称保存该图像。在您的例子中,它应该是data-sty-test.imgFileObj="${properties.fileReference}。
如果上传了图像,则会使用fileNameParameter.中提供的名称创建一个子节点
https://stackoverflow.com/questions/49422270
复制相似问题