Let’s suppose we have an archive in static resource with name “Contact” and you want to use this static resource on a page that displays Contact Photos dynamically. Assumption is that the images are stored with same name as product codes.
Code:

//Declare an apex variable which gets the Contact code from an apex property

<apex:variable var="contact_photo" value="{!contactPhoto}.jpg"/>
<img src="{!URLFOR($Resource.Products,contact_photo)}')" alt="" />

Let’s suppose we have an archive in static resource with name “Contact” and you want to use this static resource on a page that displays Contact Photos dynamically. Assumption is that the images are stored with same name as product codes.
Code:

//Declare an apex variable which gets the Contact code from an apex property

<apex:variable var="contact_photo" value="{!contactPhoto}.jpg"/>
<img src="{!URLFOR($Resource.Products,contact_photo)}')" alt="" />

Written by 

Salesforce MVP | Lightning Champion | 16x Salesforce Certified | Application Architect | 6x Trailhead Ranger | Techforce Services | Australia

Leave a Reply

Your email address will not be published. Required fields are marked *

*