You need to sign in to do that
Don't have an account?
Jithesh
Dynamically passing resource name in the image tag
I need to display an image on Vf based upon the value {!IQnews.image}.
I have createad image files for the values expected in IQnews.image and zipped them in IQNews folder. in the below line I was trying to include the value, but it s not working.
<apex:image value="{!URLFOR($Resource.IQNews, '{!IQnews.image}')}" width="50" height="50"/>
Any ideas about how to deal this scenario.
To reference a file in an archive, use the URLFOR function. Specify the static resource name that you provided when you uploaded the archive with the first parameter, and the path to the desired file within the archive with the second. For example:
I would like to dynamically pass the file name, in your example Bluehills.jpg, but in my case it comes from the variable{! IQnews.image}.
Any ides how to do it.
i'm assuming your file name comes from some sort of a property, something like this :
In this case, you can use the "imgName" variable like this :
No need to put the variable name in curly braces if you are already using URLFOR. Let me know if this works.