Expand my Community achievements bar.

SOLVED

Adding Image To A Component Dialog

Avatar

Level 7

How to add an image to a component dialog? Please help

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

In _cq_dialog/content.xml, add below line of code if you want to upload file

<file
jcr:primaryType="nt:unstructured"
sling:hideResource="{Boolean}true"
sling:resourceType="cq/gui/components/authoring/dialog/fileupload"
autoStart="{Boolean}false"
class="cq-droptarget"
fieldLabel="Image"
fileNameParameter="./fileName"
fileReferenceParameter="./fileReference"
mimeTypes="[image/gif,image/jpeg,image/png,image/tiff,image/svg+xml]"
multiple="{Boolean}false"
name="./file"
required="{Boolean}true"
title="Upload Image Asset"
uploadUrl="${suffix.path}"
useHTML5="{Boolean}true"/>

 

View solution in original post

3 Replies

Avatar

Level 1

hi @Sanjana12 

you can add this to your content.xml file to add an image

<Image
jcr:primaryType="nt:unstructured"
sling:resourceType="cq/gui/components/authoring/dialog/fileupload"
fieldLabel="Image"
fileNameParameter="./ImageName"
fileReferenceParameter="./ImageReference"
name="./Image"
/>

  

Avatar

Correct answer by
Community Advisor

In _cq_dialog/content.xml, add below line of code if you want to upload file

<file
jcr:primaryType="nt:unstructured"
sling:hideResource="{Boolean}true"
sling:resourceType="cq/gui/components/authoring/dialog/fileupload"
autoStart="{Boolean}false"
class="cq-droptarget"
fieldLabel="Image"
fileNameParameter="./fileName"
fileReferenceParameter="./fileReference"
mimeTypes="[image/gif,image/jpeg,image/png,image/tiff,image/svg+xml]"
multiple="{Boolean}false"
name="./file"
required="{Boolean}true"
title="Upload Image Asset"
uploadUrl="${suffix.path}"
useHTML5="{Boolean}true"/>