Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Invoke two concurrent instances of Image core component sling model using a single resource

Avatar

Level 5

Hi There,

I am curious to know how we can leverage the Image core component model for a single resource with two images.

Use case :

1. We have a component say hero with a requirement to have a background and a featured image.

2. We are thinking to use both images the same as the core image component and should leverage all the core image component capabilities.

Let me know your suggestions or references on the same.

Thanks,

Ravi Joshi

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

hi @Ravi_Joshi ,

 

May I know what all features/capabilities you want author to perform on images. If only path can suffice at single place, then you can have one field where author can only choose asset as highlighted in the screenshot.

 

Nikita___Garg_0-1670310960130.png

 

Hope this helps.

 

Thanks,

Nikita Garg

 

View solution in original post

4 Replies

Avatar

Employee Advisor

hi @Ravi_Joshi ,

If you are planning to utilize the OOTB image component for two fields, then both will save with property name i.e. fileReference so both background and feature will use same image.

Have you tried using that?

Thanks,

Nikita Garg

Avatar

Level 5

Hi @Nikita___Garg ,

If we use the same property name for two fields then one will override the other and we will always have a single image authored for both places. Is there any way we can overcome this problem?

Thanks,

Ravi Joshi

Avatar

Correct answer by
Employee Advisor

hi @Ravi_Joshi ,

 

May I know what all features/capabilities you want author to perform on images. If only path can suffice at single place, then you can have one field where author can only choose asset as highlighted in the screenshot.

 

Nikita___Garg_0-1670310960130.png

 

Hope this helps.

 

Thanks,

Nikita Garg