Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Show image alt text (asset title) on dialog field

Avatar

Level 2

Hi All,

 

I have a requirement where author can provide the alt text on dialog field or when the checkbox is clicked, alt text will be the image title.

I am able to set everything fine, but i also want to show the dropped image title on the dialog field. Is there any way to show the image title on dialog field other than making a ajax call through JS (I cannot do it as it is blocked).

 

Also whenever different image is dragged and dropped, I have to show its corresponding image title as alt text.

 

Thanks,

Santhosh

5 Replies

Avatar

Community Advisor

Hi @santhoshd ,

Image core component is doing the same thing. either you can create a proxy component of it or take it as reference for your custom component.

See the below image component user guide 

https://experienceleague.adobe.com/docs/experience-manager-core-components/using/components/image.ht...

And

https://www.aemcomponents.dev/content/core-components-examples/library/page-authoring/image.html

 

If you want to create proxy of it see the below article:

https://experienceleague.adobe.com/docs/experience-manager-core-components/using/get-started/using.h...

 

Hope this will help.

Umesh Thakur

Avatar

Level 2

Hi @Umesh_Thakur ,

 

Thanks for your reply.

 

We have a proxy component and I tried that as well. But it is not working. Under my custom component I am just saving the image path as property and from the sling model i am returing the assettitle (Which is working fine).

Whenever an image is dragged and dropped, under a textfield in dialog i have to show its Title (To notify author the image title that will be used). If second image is dropped, textfield has to update and show the title of second image.

 

I also tried setting value of the textfield as below but it is giving nullpointer exception.

 

${not empty video.assetTitle ? video.assetTitle : ''}
 

Thanks,

Santhosh

Avatar

Community Advisor
Can you please post your exact requirement and the solution you are using for it? will be helpful to understand

Avatar

Level 2

I have to show the image title (dc:title) in my dialog field once the author drags and drops an image. 

Avatar

Community Advisor

then here you will have to go with front-end logic as it is done for image core component.

there is one image.js in that file at line# 123 one ajax call is being made to auhtored asset meta to get all the date in json then from there it is setting to the dialog filed on the fly.

below is the path of the js file

/apps/core/wcm/components/image/v2/image/clientlibs/editor/js/image.js

 

if you have done same like that and still it is not working then try to check the response on calling .json of the image like below is the url for /content/dam/core-components-examples/library/sample-assets/mountain-range.jpg from my local and see if dc:title is there or not. if not the try with other image where you have this property.

http://localhost:4502/content/dam/core-components-examples/library/sample-assets/mountain-range.jpg/...

 

hope this will help.

Umesh Thakur