[SalesForce] Getting a static resource name from an object and use it in a VF page

I am building a managed package which refers to a set of images. These images would vary from each installation to another. So i was thinking of allowing the users to upload a static resource in their environment and add that name in an object or custom setting and i use that static resource in my VF page in managed package.

I am unsure as to how to reference the loaded static resource in my VF page.

 <apex:image value="{!URLFOR($Resource.tweets, 'ppimages/tweets1.gif')}" style="padding-left:10px"/>

I want to replace tweets with a value from a record.

I have the value to be replace the 'tweets' in a controller variable called sResourceName.

 <apex:image value="{!URLFOR($Resource.sResourceName, 'ppimages/tweets1.gif')}" style="padding-left:10px"/>

This doesnt work as its trying to see if there is a static resource called sResourceName. Is there a way i can use the value in my controller variable to get the static resource?

Best Answer

Something like :

<img src="{!URLFOR($Resource.QCreditCards,'')}/{!item.card.ImageName__c}" width="64"/>
Related Topic