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
coolKarnicoolKarni 

Apex Image

Hi,

 

This might be very silly to ask but i am facing a small issue , I need a simple information regarding passing the image URL in the apex:image tag.

How can we pass a url or the source to the image. For instance i have an image on my local harddrive how can i make it display for an image button.

 

please let me know the steps:

I tried storing the image file within the documents section.but unable to access that....

 

Thanks

 

Best Answer chosen by Admin (Salesforce Developers) 
bob17bob17

Look at loading your image as a Static Resource then you can use the global variable $Resource to reference your image.  For example, if youuploaded your image as a static resource and gave it the name "cancel", you could use the code below to reference it.  If you search on Static Resource and Image you will find lots of examples.

 

 

<img src="{!$Resource.cancel}" border="0"/>

 

All Answers

bob17bob17

Look at loading your image as a Static Resource then you can use the global variable $Resource to reference your image.  For example, if youuploaded your image as a static resource and gave it the name "cancel", you could use the code below to reference it.  If you search on Static Resource and Image you will find lots of examples.

 

 

<img src="{!$Resource.cancel}" border="0"/>

 

This was selected as the best answer
coolKarnicoolKarni

Hi Bob,

Thanks for the soln.

 

I have an issue with expand and collapse functionality to be impleamented with a visual force page.

The thing is that i have a list of values which are to bind to  a datatable or page block table and for each row within the parent Table i have a child table within it.When clicked on the particular column of a row i want to display the child table and hide when again clicked.

 

Is that possible please let me know...

provide with an example if any....

 

 

Thanks

shaan