You need to sign in to do that
Don't have an account?
prakash chaudhary
Simple logic question...need quick solution
Can I assign value in variable in VFpage ?
Since I have to show image in table according to their goal so that i decided to put same name of static resource as name of goal so please tell me that how can i assign description name which is coming from database into VFPage?
So how can i do this, value={!Resource.(discription name should come here...it is coming from my controller)}
Generally resource_name needs to idetify reource in static resource & resource_name is generally string so can I assign any variable as resource_name ?
REply me fast...
Assume I have a zip file that I've uploaded to a resource called KAB, and this has an image directory with an image named KAB.png, I can do the following:
Controller:
Page:
All Answers
No, you can't generate the resource name programmatically, only the image name.
When I've hit this in the past I've named my resources according to a pattern (e.g. KAB1 - KAB40) and then repeated the image tags with one per resource, but only rendered the one that matches the value from my controller.
E.g.
Where resourceName and imageName are controller properties. Not ideal, but has been a successful workaround.
So your mean to say here as KAB is zip file which has many images & you are referencing any one of them.
Since resource name wil be the image name along with their extension.
As I know that resource name can't be generated automatically & we have to use our logic to make them with some common name like we can show student image by their roll no.
We will assign each image name according to their roll no & when that roll no will come then we will fetch appropriate roll no image on page..
But tell me one more thing that whether this image will be shown on PDF too or it will not bcoz I am also generating PDF too.
Since I tried this one also but i was not getting any image on page so can u explain more abt it with fully executed simply example.
Thnx alot bob,
Regards...
I can't think of any reason why this wouldn't appear in a PDF page. apex:image is a safe tag to use according to the Visualforce developer's guide, and we've used images in PDF before. Have you confirmed that the image is being pulled through correctly if you remove the renderAs="pdf" attribute - its easy to put the wrong path in when pulling an image out of a static resource.
No after removing renderAs attribute it do not show me iamge there also...
This is my code..
<apex:image url="{!URLFOR($Resource.Images, 'Images/Vacation.jpg')}" width="50" height="50" />
Here Images is my zip file that i have uploaded.
Generally when I open my zip file then there is folder named Images & in that folder my all images are present.
so my above code is right or wrong.
I think i m using zip file bcoz of that facing problem....
That sounds like it should work - is your capitalization etc correct?
Yaa every capitalization is correct but i am also surprised abt it that why it is not showing me..
Let me try again for it.
& tell me that If I uploads only single image directly not bunch of images(.zip file) so by the previous way can i use that single Images directly...
Or is there any string concatanation possible so that I can pass direct image name & concat it with $Resource ?
Please tell me abt it & I am trying again from myside.
Thnx alot bob,
Hiii Bob, can u please post your code here which is working for images since I am not getting it..
Any example can you show me that is working for zip file as static resources & its contents is used.
Please give me one simple example so that I can correct out my mistake.
Please reply me fast....
Assume I have a zip file that I've uploaded to a resource called KAB, and this has an image directory with an image named KAB.png, I can do the following:
Controller:
Page: