Adobe AEM/CQ多图像组件

Adobe AEM/CQ多图像组件,adobe,aem,Adobe,Aem,我正在尝试创建一个包含两个图像和一些信息的组件,我创建了对话框,创建了节点并上传了图像。一切正常,但我找不到一种方法来获取图像的路径或渲染它 这就是我到目前为止所做的: <%@ page import="com.day.text.Text, com.day.cq.wcm.foundation.Image, com.day.cq.commons.Doctype" %> <%@include file="/apps/pla

我正在尝试创建一个包含两个图像和一些信息的组件,我创建了对话框,创建了节点并上传了图像。一切正常,但我找不到一种方法来获取图像的路径或渲染它

这就是我到目前为止所做的:

<%@ page import="com.day.text.Text,
               com.day.cq.wcm.foundation.Image,
               com.day.cq.commons.Doctype" %>
<%@include file="/apps/platform/aem-core/global/global.jsp"%>

<%
    Image image = new Image(resource, "image1");

    out.println(image);

    image.draw(out);
%>

<h2><%=image.getSrc()%></h2>

这给了我:/content/region growth/brazil/brazic poc/pt br/home/jcr:content/leadmachine new/image1/file.jpg/1456255696906.jpg,如果我转到这个文件夹,就会有一个名为image1>file的节点。图像就在那里,如果我尝试使用crxde下载它,我可以打开它,因此我相信我的问题在于路径

这是XML的对话框:

<dialog jcr:primaryType="cq:Dialog"
        title="Lead Machine"
        xtype="dialog">
    <items jcr:primaryType="cq:TabPanel">
        <items jcr:primaryType="cq:WidgetCollection">
            <generalTab jcr:primaryType="cq:Panel"
                        title="Geral">
                <items jcr:primaryType="cq:WidgetCollection">
                    <campanhaID jcr:primaryType="nt:unstructured"
                                allowBlank="false"
                                fieldLabel="Campanha ID"
                                name="./jcr:campanhaid"
                                xtype="textfield" />
                    <titulo jcr:primaryType="nt:unstructured"
                            allowBlank="false"
                            fieldLabel="Título"
                            name="./jcr:titulo"
                            xtype="textfield" />
                    <corFundo jcr:primaryType="nt:unstructured"
                              allowBlank="false"
                              fieldLabel="Cor de Fundo"
                              name="./jcr:corfundo"
                              xtype="colormenu" />
                    <corBotao jcr:primaryType="nt:unstructured"
                              allowBlank="false"
                              fieldLabel="Cor do Botão"
                              name="./jcr:corbotao"
                              xtype="colormenu" />
                    <txtBotao jcr:primaryType="nt:unstructured"
                              allowBlank="false"
                              fieldLabel="Texto do Botão"
                              ame="./jcr:txtBotao"
                              xtype="textfield" />
                    <texto jcr:primaryType="nt:unstructured"
                           allowBlank="true"
                           fieldLabel="Texto"
                           name="./jcr:texto"
                           xtype="richtext" />
                    <observacao jcr:primaryType="nt:unstructured"
                                allowBlank="true"
                                fieldLabel="Observação"
                                name="./jcr:observacao"
                                xtype="richtext" />
                    <layoutForm jcr:primaryType="cq:Widget"
                                fieldDescription="LM com formato simples"
                                fieldLabel="Layout Form"
                                inputValue="true"
                                name="./layoutForm"
                                type="checkbox"
                                xtype="selection" />
                    <agendamento jcr:primaryType="cq:Widget"
                                 fieldDescription="LM com agendamento"
                                 fieldLabel="Agendamento"
                                 inputValue="true"
                                 name="./agendamento"
                                 type="checkbox"
                                 xtype="selection" />
                    <ativo jcr:primaryType="cq:Widget"
                           fieldLabel="Ativo"
                           inputValue="true"
                           name="./ativo"
                           type="checkbox"
                           xtype="selection" />
                </items>
            </generalTab>
            <tab1 jcr:primaryType="cq:Panel" title="Image Properties">
                <image1ResType jcr:primaryType="cq:Widget" ignoreData="{Boolean}true" name="./image1/sling:resourceType" value="foundation/components/image" xtype="hidden"/>
                <image2ResType jcr:primaryType="cq:Widget" ignoreData="{Boolean}true" name="./image2/sling:resourceType" value="foundation/components/image" xtype="hidden"/>
            </tab1>
            <tab2 jcr:primaryType="cq:Widget"
                  cropParameter="./imageCrop"
                  fileNameParameter="./fileName"
                  fileReferenceParameter="./fileReference"
                  mapParameter="./imageMap"
                  name="./file"
                  requestSuffix="/img.jpg"
                  rotateParameter="./imageRotate"
                  title="Image 1"
                  xtype="html5smartimage" />
            <tab3 jcr:primaryType="cq:Widget"
                  cropParameter="./mdImageCrop"
                  fileNameParameter="./mdFileName"
                  fileReferenceParameter="./mdFileReference"
                  mapParameter="./mdImageMap"
                  name="./mdFile"
                  requestSuffix="/mdImage.img.jpg"
                  rotateParameter="./mdImageRotate"
                  title="Image 2"
                  xtype="html5smartimage" />
        </items>
    </items>
</dialog>

为什么在
tab1
中使用隐藏的
imageResType

还可以使用图像对象使用以下选项:

<% 
     Image image = new Image(resource, "file"); 
%>    

<img src='<%=image.getSrc()'/>

为什么在
tab1
中使用隐藏的
imageResType

还可以使用图像对象使用以下选项:

<% 
     Image image = new Image(resource, "file"); 
%>    

<img src='<%=image.getSrc()'/>


嗯,我从另一个对话框复制了这个对话框的一部分,这个对话框有我想要的,两张图片上传。现在我还有另一个问题,第一次我把图像上传到显示图像的组件上,当我重新加载页面并在可视化的图像dissapears上编辑组件时,可能是什么?@Terkhos add please errors log from browser's console,或者试着自己删除你的代码不起作用,我应该在返回时得到什么?我无法调试,我相信我的用户没有访问权限。您的代码在childNode上失败。getProperty(“fileReferenceParameter”)@Terkhos请提供具体的创建原因。是例外还是其他原因?@Terkhos fileReferenceParameter是指向您在damWell中的图像的路径,我复制了另一个对话框的一部分,该对话框有我想要的,两个图像上载。现在我还有另一个问题,第一次我把图像上传到显示图像的组件上,当我重新加载页面并在可视化的图像dissapears上编辑组件时,可能是什么?@Terkhos add please errors log from browser's console,或者试着自己删除你的代码不起作用,我应该在返回时得到什么?我无法调试,我相信我的用户没有访问权限。您的代码在childNode上失败。getProperty(“fileReferenceParameter”)@Terkhos请提供具体的创建原因。是例外还是其他情况?@Terkhos fileReferenceParameter是指向dam中用户图像的路径