【问题标题】:Not able to show image on dialog box in AEM无法在 AEM 的对话框中显示图像
【发布时间】:2015-08-13 04:34:02
【问题描述】:

我正在尝试创建一个带有图像预览的对话框。我能够创建包含所有字段的对话框,但我面临图像问题。我已经看到了图像组件,您可以在其中拖放图像,但我需要在打开对话框组件时显示图像。有没有没有拖放的组件。

我已尝试使用 html5smartimage 图像但无法正常工作。请看下面的代码:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:Dialog"
height="{Long}500"
title="Test Dialog"
width="{Long}800"
xtype="dialog">
<items
    jcr:primaryType="cq:Widget"
    xtype="tabpanel">
    <items jcr:primaryType="cq:WidgetCollection">
        <tab1
            jcr:primaryType="cq:Panel"
            title="Component Details">
            <items jcr:primaryType="cq:WidgetCollection">
                <image
                    jcr:primaryType="cq:Widget"
                    cropParameter="./imageCrop"
                    ddGroups="[media]"
                    fileNameParameter="./fileName"
                    fileReferenceParameter="./fileReference"
                    mapParameter="./imageMap"
                    name="./file"
                    requestSuffix=".img.png"
                    rotateParameter="./imageRotate"
                    title="Image"
                    xtype="html5smartimage">
                    <icon.png jcr:primaryType="nt:file">
                        <jcr:content
                            jcr:data="{Binary}"
                            jcr:lastModified="{Date}2015-07-28T19:27:46.878+05:30"
                            jcr:lastModifiedBy="admin"
                            jcr:mimeType="image/png"
                            jcr:primaryType="nt:resource"
                            jcr:uuid="754c14c8-4423-45df-b982-06bfc13dc6e3"/>
                    </icon.png>
                </image>
            </items>
        </tab1>
    </items>
    </items>
</jcr:root>

请帮我解决这个问题。

【问题讨论】:

    标签: extjs aem


    【解决方案1】:

    我认为没有必要使用html5smartimage,如果您只想在对话框中显示静态图像(也不需要提交)。

    您可以使用 xtype displayfield 并使用 html 属性,如下所示。

    <?xml version="1.0" encoding="UTF-8"?>
    <jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0"
        xmlns:jcr="http://www.jcp.org/jcr/1.0" 
        xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
        jcr:primaryType="cq:Dialog"
        height="{Long}500"
        title="Test Dialog"
        width="{Long}800"
        xtype="dialog">
        <items
            jcr:primaryType="cq:Widget"
            xtype="tabpanel">
            <items jcr:primaryType="cq:WidgetCollection">
                <tab1
                    jcr:primaryType="cq:Panel"
                    title="Component Details">
                    <items jcr:primaryType="cq:WidgetCollection">
                        <displayimage jcr:primaryType="cq:Widget" 
                            html="<img src='/content/dam/geometrixx/icons/target.png'>" 
                            xtype="displayfield" />
                    </items>
                </tab1>
            </items>
        </items>
    </jcr:root>
    

    将图像src 替换为您要在对话框中显示的图像的路径。

    【讨论】:

    • 我尝试了这个解决方案,但 html 属性对我不起作用。 fieldDescription 成功了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-16
    • 2023-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多