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
JN22JN22 

Image Not Loading

Hello,

 

I have a VF page that I created on a custom object.  In that page, I am loading an image within a table.  The image is saved as a GIF file in my Documents object in SFDC.  Everything worked as it should in the past but I recently made a change to the image that is supposed to show and the code is still showing the prior image.  Does anyone know why this would be happening as the old image is not even in the Documents object anymore?  The line of code I am using is below.  Thanks,

 

<img src="/servlet/servlet.FileDownload?file=01570000001M9Vp" alt="Essential" title="Essential"/>

Best Answer chosen by Admin (Salesforce Developers) 
Val ValinoVal Valino

It is using cached image, I'm guessing.

All Answers

Val ValinoVal Valino

It is using cached image, I'm guessing.

This was selected as the best answer
JN22JN22

I cleared my cache and it is now showing the proper image.  Odd that it would do that given that there is a link.  Do you know if there is anyway around it or do I just need to cleat my cache if I make future changes?

Val ValinoVal Valino

Do you have cache="true" in the apex:page tag? If you do, you could specify it to false. 

JN22JN22

No, I don't have anything which is supposed to mean it defaults to false, according to the component reference.

Val ValinoVal Valino

I'm not quite sure but I suggest trying the apex:image tag instead of the HTML img tag. I have never had problems with the apex:image tag. 

donnaklinton1.389152296990147E12donnaklinton1.389152296990147E12
HI there
If you just want to load the image (http://www.rasteredge.com/how-to/csharp-imaging/load-from-file/) ,you can refer to this code:
namespace RE__Test
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string fileName = "c:/Sample.png";

            REImage reImage = REFile.OpenImageFile(fileName);

            REFile.SaveImageFile(reImage, "c:/reimage.png", new PNGEncoder());
It is from an image tool in Google.Hope to help you.