You need to sign in to do that
Don't have an account?
John Upton 8
Basic dynamic image display
Hi. I'm trying to get a image to display on a Visualforce page. I have added a Static Resource, and can get it to display if I cite its name directly, but if I try to reference it using a variable, I either get an error in compilation, or a small 'dummy' image like it can't find the one I've specified.
The code that works find is as follows:
<apex:page standardController="Account">
<apex:variable var="imageVar" value="MMC_Logo"/>
<p>Resource name {!imageVar}</p>
<apex:image url="{!$Resource.MMC_Logo}"/>
</apex:page>
However, if I add a penultimate line of
<apex:image url="{!$Resource.(imageVar)"/>
I get the small 'dummy' image displayed.
Surely this is just a minor syntaxical error, but nothing I have tried will work! Can someone point me in the right direction?
Thanks..
The code that works find is as follows:
<apex:page standardController="Account">
<apex:variable var="imageVar" value="MMC_Logo"/>
<p>Resource name {!imageVar}</p>
<apex:image url="{!$Resource.MMC_Logo}"/>
</apex:page>
However, if I add a penultimate line of
<apex:image url="{!$Resource.(imageVar)"/>
I get the small 'dummy' image displayed.
Surely this is just a minor syntaxical error, but nothing I have tried will work! Can someone point me in the right direction?
Thanks..
The example at the last of the page in the doc reference you have give is for zip resources.
You can zip your picture and upload on static resource then you can refer that image through variable same way mentioned in the doc.
All Answers
The example at the last of the page in the doc reference you have give is for zip resources.
You can zip your picture and upload on static resource then you can refer that image through variable same way mentioned in the doc.
Now I have managed my most simple scenerio, I will have to create myself a more complicated controller so as to get different images to display based on the user, but we can consider this post closed I think. Thanks again. :)
* contain no spaces
* be referenced with exactly the same case (i.e. case-sensitive)
This example is without using zip file, access image from static resource.