1

Image is showing up in internal visualforce page but not showing up in external visualforce site page.I have stored image in document and made it externally available and document folder is accessible to all users. Also provided View All access to Document object under site profile settings. Here is the image formula field.

IF( ISPICKVAL(Status__c,"Up"), IMAGE("/servlet/servlet.FileDownload?file=015t00000004k4D", "Green"), 
IF ( ISPICKVAL(Status__c,"Down"), IMAGE("/servlet/servlet.FileDownload?file=015t00000004k4N", "Red"), 
IMAGE("/servlet/servlet.FileDownload?file=015t00000004p4I", "Yellow")))

Here is the part of visualforce page

    <apex:dataTable value="{!OutList}" var="o"  rows="11" styleClass="table" > 
         <apex:column value="{!o.Service__c}" headerValue="Service" headerClass="colHeadr"/>
         <apex:column value="{!o.Status__c}" headerValue="Status"  headerClass="colHeadr"/>
          <apex:column value="{!o.Image__c}" headerValue="Image"  headerClass="colHeadr"/>
     </apex:dataTable>
2
  • 3
    Alternative for Sites: put images in a static resource
    – cropredy
    Commented Apr 28, 2016 at 15:48
  • @cropredy Thank you.It worked.Can you post this as Answer
    – sfdc
    Commented Apr 28, 2016 at 16:01

1 Answer 1

3

To get access to images in SITES, simply add the images into a zip file and save as a public static resource. Reference the static resource using VF markup:

<apex:image url="{!URLFOR($Resource.TestZip, 'images/Bluehills.jpg')}" width="50" height="50" />
3
  • Doesn't the Static Resource need to be public for this to work? I believe it will fail otherwise.
    – Adrian Larson
    Commented Apr 28, 2016 at 16:53
  • @AdrianLarson yep - thanks, I actually ran into this the other day and wondered for about an hour why I couldn't access the resources
    – cropredy
    Commented Apr 28, 2016 at 16:55
  • Yeah that gotcha has caught me before too and it is hard to hunt down the reason if you don't know it already.
    – Adrian Larson
    Commented Apr 28, 2016 at 16:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .