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
Suneel#8Suneel#8 

How to fetch images from external system in a callout

I need to access images from external system using HTTP callouts and display them in Salesforce.
Content-Type →image/png is the format of the reponse Salesforce is receiving
Can we use Blob to store images?
Could anyone throw light on this
Praful GadgePraful Gadge
Hi Suneel,

You want to store images in Salesforce database? Or you just want to display it on visualforce page?

If you want to display, you can directly add an URL of the image, no need to store it to database.
<img src="anysite.com/url_of_the_image.png" >
Please let me know if it helps.

If this post is your solution, kindly mark this as the solution to the post so that others may benefit.

Regards,
Praful G.
Suneel#8Suneel#8
Hi Praful,

I want to fetch the image from external system and show it on UI without having to save it to Salesforce.
Link-https://www.sundoginteractive.com/sunblog/posts/saving-the-contents-of-an-image-or-file-url-and-saving-to-an-attachment-or explains how to fetch the image from external system. It solves some of my problem.I would like to know how to display the image stored in blob variable in UI.

I do not have a URL in this case as the image is stored in an oracle database and can be accessed only through a callout
Praful GadgePraful Gadge
Hi Suneel,

Please check this jsFiddle (http://jsfiddle.net/hpP45/). You may need to dislay image as follows:
<img src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUA
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" />
Please try and let me know if any issue.

If this post is your solution, kindly mark this as the solution to the post so that others may benefit.

Regards,
Praful G.adge