AEM / CQ5 html5smartimage文件名在图像上传时丢失 [英] AEM/CQ5 html5smartimage filename lost on image upload

查看:99
本文介绍了AEM / CQ5 html5smartimage文件名在图像上传时丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用允许用户上传图像的 html5smartimage

I'm using an html5smartimage that allow the user to upload an image.

这是我的对话框配置:

<?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"
          jcr:primaryType="cq:Dialog" height="600" width="900" xtype="dialog">
    <items jcr:primaryType="cq:WidgetCollection">
        <tabs jcr:primaryType="cq:TabPanel">
            <items jcr:primaryType="cq:WidgetCollection">
                <tabText
                        jcr:primaryType="cq:Widget"
                        anchor="100%"
                        title="Text"
                        xtype="panel">
                    <items jcr:primaryType="cq:WidgetCollection">
                        <richFlag
                                jcr:primaryType="cq:Widget"
                                ignoreData="{Boolean}true"
                                name="./textIsRich"
                                value="true"
                                xtype="hidden"/>
                        <text
                            jcr:primaryType="cq:Widget"
                            editElementQuery="div[class=&quot;text&quot;]"
                            hideLabel="{Boolean}true"
                            name="./text"
                            xtype="richtext"/>
                    </items>
                </tabText>

                <tabImage
                        jcr:primaryType="cq:Widget"
                        title="Image"
                        xtype="panel">
                    <items jcr:primaryType="cq:WidgetCollection">
                        <title jcr:primaryType="cq:Widget"
                               fieldLabel="Title"
                               name="./image/jcr:title"
                               xtype="textfield"/>
                        <alt jcr:primaryType="cq:Widget"
                             fieldLabel="Alt"
                             fieldDescription="(leave empty to use the title defined above)"
                             name="./image/alt"
                             xtype="textfield"/>
                        <description
                                jcr:primaryType="cq:Widget"
                                fieldLabel="Description"
                                name="./image/jcr:description"
                                xtype="textarea"/>
                        <size
                                jcr:primaryType="cq:Widget"
                                fieldLabel="Size"
                                heightParameter="./image/height"
                                widthParameter="./image/width"
                                xtype="sizefield"/>

                        <image
                                jcr:primaryType="cq:Widget"
                                allowUpload="{Boolean}true"
                                cropParameter="./image/imageCrop"
                                ddGroups="[media]"
                                width="{Long}300"
                                height="{Long}350"
                                fileNameParameter="./image/fileName"
                                fileReferenceParameter="./image/fileReference"
                                mapParameter="./image/imageMap"
                                name="./image/file"
                                requestSuffix="/image.img.png"
                                rotateParameter="./image/imageRotate"
                                title="Image"
                                xtype="html5smartimage">
                            <items jcr:primaryType="cq:WidgetCollection">
                                <resType
                                        jcr:primaryType="cq:Widget"
                                        ignoreData="{Boolean}true"
                                        name="./image/sling:resourceType"
                                        value="foundation/components/image"
                                        xtype="hidden"/>
                            </items>
                        </image>


                    </items>
                </tabImage>

            </items>
        </tabs>
    </items>
</jcr:root>

使用此配置,我的图像将保存为名为 nt:file 的节点文件。

Using this configuration my image is saved as an nt:file node named "file".

无论如何,我完全失去了其真实姓名的信息。如何获取此信息?

Anyway I completely lost the information of its real name. How can I retrieve this info?

推荐答案

您应设置 transferFilename 属性图像节点到 true

You should set transferFilename property of image node to true

<image
    jcr:primaryType="cq:Widget"
    allowUpload="{Boolean}true"
    cropParameter="./image/imageCrop"
    ddGroups="[media]"
    width="{Long}300"
    height="{Long}350"
    fileNameParameter="./image/fileName"
    fileReferenceParameter="./image/fileReference"
    mapParameter="./image/imageMap"
    name="./image/file"
    requestSuffix="/image.img.png"
    rotateParameter="./image/imageRotate"
    title="Image"
    xtype="html5smartimage"
    transferFileName="true">

然后,原始文件名将保存到 fileName 图片节点的属性。

Then the original filename will be saved to fileName property of image node.

这篇关于AEM / CQ5 html5smartimage文件名在图像上传时丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆