Home Using static resource Dynamically

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="" />

Leave a Comment

*