0

I have uploaded html file in static resource as type text/html. While i am referencing that html file in the VF page images are not displaying on the page but html is having the image attribute.

<apex:page sidebar="false" contentType="text/html">
<style>
h3{
  color:blue;
  text-align:right;
  padding:30px;
  font-size:25px;
  line-height:125%;
  border:25px;
}       
</style>
   <h3> <apex:outputLink value="{!URLFOR($Resource.Test)}" id="thelink" target="_blank"> Page2 </apex:outputLink> </h3>
   <br> 
 <iframe src="{!URLFOR($Resource.Test)}" width="100%" height="100%" scrolling="true" style="border:none"></iframe>
 </br>
</apex:page>
  • if you could include debug info that would be nice, such as, what status code do you see when trying to get the images? "images are not displaying" is not very helpful for troubleshooting. Thanks – glls Oct 16 '17 at 0:25
1

I used your code with the following HTML code (see below) and it worked fine. Are you using a relative path for the image? If you try to access your html file directly using WAMP http://localhost/imagename does it display?

<head>
<body>
<img src="https://www.google.co.il/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png">
</body>
</head>
  • Thanks for the reply. I tried to access the image that was saved in my local host. So images are not displayed. I saved the image in static resource, by clicking on the view file, it routes me to the page. When i copied and pasted the url in the "src" then i am able to view the image on the page. – user5558 Sep 29 '15 at 7:15
  • 1
    What I am curious is if your file name or folder is the issue? If you pasted that same code and ran the html page (via wamp or whatever) and can not get the image to load, it won't work in SF either. Once you can get the html page to display the image, then there is what to talk about. – user24509 Oct 6 '15 at 5:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.