function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Angel ZAngel Z 

Aura Component - display image from file

Hi all,

I need to display an image from a file to an aura component.

Can someone give me a piece of advice for the img source?

I tried 
<img src="{!'/sfc/servlet.shepherd/version/download/0681w000000iOxfAAE'}" />

However, it does not work.

Thanks,
Angel
Deepali KulshresthaDeepali Kulshrestha
Hi Angel,

You can try adding your image in the static resource and refer to the static resource by using the following method:

for stylesheets: <ltng:require styles="{!$Resource.<your_resource_name> +
             '/assets/styles/salesforce-lightning-design-system-ltng.css'}"/>

for image: <img src="{!$Resource.<your_resource_name> + '/assets/icons/action/user_60.png'}"></img>


I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com