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
debbymdebbym 

Image referenced in s-control

Newbie question: I'm creating an s-control for use as a custom button.  I want the s-control to display an image.  Can I upload the image to salesforce and reference it there (ie use it as the "SRC" attribute in an <IMG> tag)?

Thanks

DevAngelDevAngel
Sure, just upload your image to the documents tab.  Once uploaded, and looking at the list of documents for the folder that you created the image in, right click the view link to obtain the link source.  This is the source for the img tag.  Tip: you can use a relative url for this.
debbymdebbym
Thank you.  But now if I package the s-control and image document in an application, will the image url be valid when the app is deployed?
Thanks
DevAngelDevAngel
Nope.  An alternative is to give the image doc a name, and as your scontrol loads, query for the id of the doc by name and "rebuild" the url to the img src.
n8n8
Actually, that shouldn't be necessary.  AppExchange upload should correctly remap the document id in the scontrol source, so that the URL points to the image document in the installing organization.  If that's not happening, it's a bug.
michaelforcemichaelforce
I concur... I have an App I've created with many images from the documents tab.  The packaging process is smart enough to seek them out and resolve them upon installation.