Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Default Image in dialog for file upload in aem dialog

Avatar

Level 2

We have a requirement where in we have to show a default image once a dialog is opened. Then we can select the image we need. The image resourcetype is fileupload.  can someone help ?

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @sirishap9577191 ,

 

Please try to use cq:template. The use case for this property can be if you want to provide the default
values of properties of a component, then it can help you out.
 
 
-Tarun

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @sirishap9577191 ,

 

Please try to use cq:template. The use case for this property can be if you want to provide the default
values of properties of a component, then it can help you out.
 
 
-Tarun

Avatar

Community Advisor

Example structure in CRXDE:

/apps/my-project/components/content/my-component
└── cq:template (nt:unstructured)
    └── fileReference (String) = /content/dam/my-project/default-image.jpg

 

Example dialog.xml:

<image
                                                jcr:primaryType="nt:unstructured"
                                                sling:resourceType="cq/gui/components/authoring/dialog/fileupload"
                                                allowUpload="{Boolean}false"
                                                autoStart="{Boolean}false"
                                                class="cq-droptarget"
                                                fieldDescription="Browse an Image"
                                                fieldLabel="Image"
                                                fileNameParameter="./fileName"                                             fileReferenceParameter="./fileReference"
                                                mimeTypes="[image]"
                                                multiple="{Boolean}false"
                                                name="./file"
                                                title="Upload Image Asset"
                                                uploadUrl="${suffix.path}"
                                                useHTML5="{Boolean}true"/>

 



Arun Patidar