function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vinay KolusuVinay Kolusu 

Use a static resource to display an image on a Visualforce Page

I have a strange situation here , The same set of code is executing fine in one line , and failing in the other.  I am attaching the image for more details. Also the trail challenge is in complete throwing an error saying the static resource is not referenced . 

you can see the image icon and kitten being displayed for the two lines that we have written.


Thanks in advance.screen shot
Best Answer chosen by Vinay Kolusu
SandhyaSandhya (Salesforce Developers) 
Hi Vinay,

I Have tested with two lines; it is working for me in chrome.Which browser are you using?

Please copy paste this code and see if it works.
<apex:page >
<apex:image value="{!URLFOR($Resource.vfimagetest,'cats/kitten1.jpg')}"/>
<apex:image value="{!URLFOR($Resource.vfimagetest,'cats/kitten1.jpg')}"/>
</apex:page>
Please let us know if this helps you!

Thanks and Regards
Sandhya


 

All Answers

SandhyaSandhya (Salesforce Developers) 
Hi Vinay,

I Have tested with two lines; it is working for me in chrome.Which browser are you using?

Please copy paste this code and see if it works.
<apex:page >
<apex:image value="{!URLFOR($Resource.vfimagetest,'cats/kitten1.jpg')}"/>
<apex:image value="{!URLFOR($Resource.vfimagetest,'cats/kitten1.jpg')}"/>
</apex:page>
Please let us know if this helps you!

Thanks and Regards
Sandhya


 
This was selected as the best answer
Vinay KolusuVinay Kolusu
Thanks Sandhya, I was using IE for this. I had succesfully completed the challenge, however was curious for the particular error that i came across. 
Umer Farooq 23Umer Farooq 23

Didn't work in my case.

<apex:page>
<apex:image value="{!URLFOR($Resource.vfimagetest,'TestImgFolder/Three.png')}"/><apex:image value="{!URLFOR($Resource.vfimagetest,'TestImgFolder/Two.jpg')}"/>
</apex:page>
 

I'm trying to get static resource in page view with same Here is the inspected screenshot
**Any usefull input will be appricicated.**

BraneBrane
Umer Farooq 23 did you double check the formats of the files? 
The file  with name Three is png and the other with the name Two is jpg...
 
Andrew S DayAndrew S Day
Do not use IE for development.  It's awful. Chrome or Firefox is the industrty standard.