Adding Image To A Component Dialog | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by HeenaMadan

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"/>

 

3 replies

Mohit_KBansal
Adobe Employee
Adobe Employee
August 23, 2022
August 23, 2022

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"
/>

  

HeenaMadan
Community Advisor and Adobe Champion
HeenaMadanCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
August 23, 2022

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"/>