display static resource image in lwc -- w3web.net

How to display static resource image uses of Import library of “@salesforce/resourceUrl” in Salesforce Lightning Web Component — LWC | how to access static resource image and display in lwc component in Salesforce

Hey guys, today in this post we are going to learn about How to display static resource image uses of Import “@salesforce/resourceUrl” library in Salesforce Lightning Web Component (LWC).

What is the use of static resource in Salesforce →

Static resources allow you to upload content that you can reference in a Visualforce page. Resources can be archives (such as .zip and .jar files), images, stylesheets, JavaScript, and other files.

Static resources are referenced using the $Resource global variable, which can be used directly by Visualforce, or used as a parameter to functions such as URLFOR(). To know more about static resource in Salesforce, Click Here.

 

Files we used to display static resource image in LWC →

lwcStaticResourceImg.html LWc HTML File Template HTML file to get static resource image in Salesforce Lightning Web Component (LWC)
lwcStaticResourceImg.js LWC JavaScript File It’s hold a javascript where we importing “@salesforce/resourceUrl” library in lwc.
lwcStaticResourceImg.js-meta.xml XML Meta File It is used to where this lightning web component file you want to display as lightning__AppPage, lightning__RecordPage, lightning__HomePage.
lwcStaticResourceImgApp.app Lightning Application It is used for call the component and preview on browser.

Live Demo →

display static resource image in lwc -- w3web.net

Final Output →

Other related post that would you like to learn in LWC

  • Find the below steps

Create Lightning Web Component HTML →

Step 1:- Create Lightning Web Component : lwcStaticResourceImg.html

SFDX:Lightning Web Component >> New >> lwcStaticResourceImg.html

lwcStaticResourceImg.html [Lightning Web Component HTML]

Create Lightning Web Component JavaScript →

Step 2:- Create Lightning Web Component : lwcStaticResourceImg.js

SFDX:Lightning Web Component >> New >> lwcStaticResourceImg.js

lwcStaticResourceImg.js [LWC JavaScript File]

Create Lightning Web Component Meta XML →

Step 3:- Create Lightning Web Component : lwcStaticResourceImg.js-meta.xml

SFDX:Lightning Web Component >> New >> lwcStaticResourceImg.js-meta.xml

lwcStaticResourceImg.js-meta.xml [LWC Meta Data XML]

Create Lightning Application →

Step 4:- Create Lightning Application : lwcStaticResourceImgApp.app

From Developer Console >> File >> New >> Lightning Application

lwcStaticResourceImgApp.app [Component Application File]

display static resource image in lwc — w3web.net

Further post that would you like to learn in LWC

 

Flyout is a free, simple way to earn money.

If you think you and your family members also like to earn money in additional time, then go this link. In this site, you can earn money for the lifetime at low effort. To Earn Unlimited Everyday With This Trick, Sign Up Free.. Get Started for Free

Flyout is a free, simple way to earn money by placing sponsored content on your blog

Check Out:- Earn Unlimited Everyday With This Trick:- Click Here

 

FAQ (Frequently Asked Questions)

How do I find static resources in Salesforce?

From Setup, enter Static Resources in the Quick Find box, then select Static Resources. To view the resource details, click the name of a resource.

How do you display static resource image in lightning component?

we can use $Resource. resourceName within an expression. resourceName is the Name of the static resource.

How do I update a static resource in Salesforce?

Click New Static Resource to define a new static resource. After that click a resource name to display detailed information about the page, including its MIME type and size. After that click Edit next to a resource to modify the resource's name or to upload a new version of the resource.

Related Topics | You May Also Like

Hi, This is Vijay behind the admin and founder of w3web.net. I am a senior software developer and working in MNC company from more than 8 years. I am great fan of technology, configuration, customization & development. Apart of this, I love to write about Blogging in spare time, Working on Mobile & Web application development, Salesforce lightning, Salesforce LWC and Salesforce Integration development in full time. [Read full bio] | The Sitemap where you can find all published post on w3web.net

Leave a Comment