@ac6600 Add below code in _cq_dialog_/content.xml
<imagePath allowUpload="{Boolean}false"
autoStart="{Boolean}false"
class="cq-droptarget"
cq-msm-lockable="./file"
fieldDescription="Choose Image "
fieldLabel="Logo Image"
fileReferenceParameter="./fileReference"
jcr:primaryType="nt:unstructured"
mimeTypes="[image/gif,image/jpeg,image/png,image/webp,image/tiff,image/svg+xml]"
multiple="{Boolean}false"
name="./imagePath/file"
sling:resourceType="cq/gui/components/authoring/dialog/fileupload"
title="Drag to select image"
required="{Boolean}true"
uploadUrl="${suffix.path}"
useHTML5="{Boolean}true"/>
In sling model add below line of code
@Getter
@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = "fileReference")
private String imageSrc;
and in component HTML file
<sly data-sly-use.myModel="com.project..models.MyModel">
${myModel.imageSrc} //prints image path
<img src="${myModel.imageSrc}"/> //render image
</sly>
If you want to access image directly in sightly then use
<img src="${properties.fileReference}"/>