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
ShabsShabs 

display image using Scontrol

I wnated to know if there was any facility to display a small image on the form using Scontrol. Where will the image reside? on our server or on Salesforce server.
 
Do we have to extrenally reference the image?
 
Please let me know
 
Thanks
Ali
werewolfwerewolf
Yes, it's easy, just put an IMG tag on your scontrol.  For the record, you can also show an image in a custom formula field, which is better if you just want to show a quick inline image.

Here's an scontrol I wrote for this purpose (it's a clickable image with an image map, old school I know):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <script type="text/javascript" src="/js/functions.js"></script>
    <script src="/soap/ajax/11.0/connection.js"></script>
</head>

<body>
<map name="map1">
    <area href="http://www.lycos.com" shape="rect" coords="0, 75, 150, 175"/>
    <area href="http://www.nba.com" shape="rect" coords="150, 75, 300, 175"/>
</map>
<img
usemap="#map1"
border="0"
src="https://na3.salesforce.com/servlet/servlet.ImageServer?id=01550000000R0dI&oid=00D500000008Khr"/>
</body>
</html>
shabs1shabs1

Sorry to sound silly here but my question is where will the image reside. In other words can i tag an image which is not externally stored or referenced?

i want to put a small image next to my custom made button. The image file name is right.gif. I know how to show the image if teh source is externally referenced eg: src=http://www.mydomain.com/images/right.gif HOWEVER if i wnated to actually host the image on salesforce then can it be done? if yes then how where and how to upload the image on salesforce server..

Many Thanks

A

 

sfdcfoxsfdcfox
If you want to host a file on Salesforce, you can use the documents tab, or you can create a static resource and reference it that way.

To display the file stored as a document, you can use /servlet/servlet.ImageServer?id=documentid&oid=orgid. Be sure to mark the file as "Externally available image", or the link will fail.

As a static resource, you can then reference it as {!$Resource.FileName}.
shabs1shabs1
Lovely - Thank you so much. Thsi works!!