You need to sign in to do that
Don't have an account?
The new Learner
how to call static resource image from Html in salesforce
Hi Experts,
I have requirment in that i am preparing an page , mostly i used html but here issue is that i used an image from my system but its not working for other users so i am looking for alternative soluation so i thought to call an image from static resource but i am not sure how to call from my html page or else in CSS also fine for me . kindly help me out. below is the code which i called in my html page.
<header>
<br></br>
<img src="D:\Users\Logo-without-Tagline_Black.png" style="width:100%;height:250px;"/>
</header>
Kindly help me out.
Thanks in advance
I have requirment in that i am preparing an page , mostly i used html but here issue is that i used an image from my system but its not working for other users so i am looking for alternative soluation so i thought to call an image from static resource but i am not sure how to call from my html page or else in CSS also fine for me . kindly help me out. below is the code which i called in my html page.
<header>
<br></br>
<img src="D:\Users\Logo-without-Tagline_Black.png" style="width:100%;height:250px;"/>
</header>
Kindly help me out.
Thanks in advance
As seethal said that was correct.
You can use static resource these types on visualforce page.
<apex:image url="{!$Resource.logo}"/>
<img src="{!$Resource.logo}"/>
But as you are saying the html form is in your local drive then you have to use the public static image url. You can configure site to access that static resource public.
The static resource URL will be like that :- https://yogeshtailor-developer-edition.ap5.force.com/resource/1504896311011/logo
<img src="https://yogeshtailor-developer-edition.ap5.force.com/resource/1504896311011/logo" />
Thanks,
Yogesh
All Answers
<apex:image url="{!$Resource.TestImage}" width="50" height="50"/>
OR
<img src="{!URLFOR(!$STATICRESOUCE)}"/
I havent used any apex tag in my html page.
here "(!$STATICRESOUCE)}"/" do i need to paste image name over here i mean in staticresource. how kindly me help me out. my image name is logo in static resource.
Thanks,
and paste the staticresource name in that
I have tried as you said like below. but its not working.
<header>
<br></br>
<img src="{!URLFOR(!$Shure_Logo)}" style="width:100%;height:250px;"/>
</header>
AND ENSURE THAT THE STATIC RESOURCE IS PUBLIC
As seethal said that was correct.
You can use static resource these types on visualforce page.
<apex:image url="{!$Resource.logo}"/>
<img src="{!$Resource.logo}"/>
But as you are saying the html form is in your local drive then you have to use the public static image url. You can configure site to access that static resource public.
The static resource URL will be like that :- https://yogeshtailor-developer-edition.ap5.force.com/resource/1504896311011/logo
<img src="https://yogeshtailor-developer-edition.ap5.force.com/resource/1504896311011/logo" />
Thanks,
Yogesh
Can you help me out , how to configure the public static image url please.
Thanks
Have you created site for that? If not go to site and create new site and activate it.
Then goto Static Resource -> View
URL will be Like that : https://yogeshtailor-developer-edition.ap5.force.com/resource/1504896311011/logo
Copy the Address bar URL and paste it in <img src="URL"> .
Thanks,
Yogesh
<img src="/sfsites/c/resource/<static resource name>">
Thanks
Deva
To call a static resource image from HTML in Salesforce, you need to use the following format : Replace ResourceName with the name of your static resource, and ImageName.extension with the name of your image file (e.g. "logo.png").
Discover more about static resources by visiting https://arrify.com/static-resources-in-salesforce/. This article provides a comprehensive guide to managing static resources in Salesforce, including Visualforce pages, Apex classes, Lightning Web Components, and Aura Components.