You need to sign in to do that
Don't have an account?
Robert Robinson
Trailhead challenge: Use a static resource to display an image on a Visualforce Page
The challenge (aka "Hello Kitty"):
Upload a specified zip file as a static resource. The zip will have directories with images and you have to display a specific image on a Visualforce page.The page must be named 'ShowImage'.
This file must be uploaded as a Static Resource named 'vfimagetest'.
The page must have a Visualforce apex:image tag that displays the 'kitten1.jpg' image from the 'cats' directory of the static resource.
I have uploaded vfimagetest and made it public. I unzipped the file (maybe my first mistake) and can see the kitten1.jpg file. My code is:
<apex:page>
<apex:image url="{!URLFOR($Resource.vfimagetest,'images/kitten1.jpg')}" width="50" height="50"/>
</apex:page>
The code saves; however, I cannot see the file. I know that I am missing something simple. If someone can assist, I can start my self flogging in earnest. Thanks.
Upload a specified zip file as a static resource. The zip will have directories with images and you have to display a specific image on a Visualforce page.The page must be named 'ShowImage'.
This file must be uploaded as a Static Resource named 'vfimagetest'.
The page must have a Visualforce apex:image tag that displays the 'kitten1.jpg' image from the 'cats' directory of the static resource.
I have uploaded vfimagetest and made it public. I unzipped the file (maybe my first mistake) and can see the kitten1.jpg file. My code is:
<apex:page>
<apex:image url="{!URLFOR($Resource.vfimagetest,'images/kitten1.jpg')}" width="50" height="50"/>
</apex:page>
The code saves; however, I cannot see the file. I know that I am missing something simple. If someone can assist, I can start my self flogging in earnest. Thanks.
All Answers
I pointed at the unzipped folder, not the zipped file... Hello kitty...
"Meow"
And - as already mentioned: Be sure that you upload the .zip file not the extracted files.
<apex:image url="{!URLFOR($Resource.vfimagetest,'cats/kitten1.jpg')}" width="50" height="50"/>
</apex:page>
Bold path is requiredd
For some reason i am getting the following error
:Static Resource named vfimagetest does not exist. Check spelling. It looks perfectly fine to me.
Please help!
Thank you
Venkat
width="50" height="50" attributes the challenge is wrong :S. That is really odd to me
<apex:page showHeader="false" sidebar="false" standardStylesheets="false">
<apex:image alt="kitten1" title="kitten" url="{!URLFOR($Resource.vfimagetest, 'cats/kitten1.jpg')}"/>
</apex:page>
Worked just fine for me.
and I couldn't get a success. I used Magnus' code and it worked:
1- Upload the file to:
Setup -> Static Resources -> New:Name: vfimagetest | Cache Control: Public
2- Enter the code in the Developer Console as follows:
<apex:page>
<apex:image alt="eye" title="eye"
url="{!URLFOR($Resource.vfimagetest, 'cats/kitten1.jpg')}"/>
</apex:page>