Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Hot answers tagged

11 votes

How can I dynamically load a static resource image in LWC?

You would normally upload a ZIP file, and use it in the manner described in the docs: import TRAILHEAD_CHARACTERS from '@salesforce/resourceUrl/trailhead_characters'; // ... einsteinUrl = ...
user avatar
  • 430k
8 votes
Accepted

Referencing Externally Available Images Absolute URL with My Domain?

I solved this in our org by changing the URL to the following: https://mydomain.my.salesforce.com/servlet/servlet.ImageServer?id=015a00000030EqL&oid=00D30000000X7qS&lastMod=1392744621000 ...
user avatar
7 votes
Accepted

How to set public inline images in Knowledge Base Article

You can expose the image through a site. You only need to change the instance url by the site home page. Also, you need to establish the article as public. Site Profile Changes: Set field where ...
user avatar
7 votes
Accepted

How to include images from static resources in lightning components used in communities?

Your community will have a URL prefix and you will need to add that prefix as well <img src="/urlpathprefix /resource/Icon_one" height="30" width="30"/> You can return this prefix using ...
user avatar
7 votes
Accepted

Retrieving the profile photo for a user

Use user's FullPhotoUrl and SmallPhotoUrl fields VF code: <apex:page controller="cls_PhotoUrl"> <apex:form> <apex:image value="{!...
user avatar
7 votes
Accepted

How to find image dimensions using apex

This is my approach. The most glaring inefficiency is calling convertToHex on the image blob. It only knows about PNG, JPEG, and GIF. This is code I've pieced together by reading file format specs, ...
user avatar
  • 255
6 votes
Accepted

How to Check if the uploaded file is Image

You will need to check the Content-Type of attachment loaded String contenttype=Attachment.contenttype; if(contenttype=='image/jpeg' || contenttype=='image/png' || contenttype=='image/gif' || ...
user avatar
6 votes
Accepted

How to access "servlet/rtaImage" resources over the API

You might be able to use the OAuth accessToken in a cookie with the HTTP GET request to servlet/rtaImage depending on the scope you requested when getting it. I believe you will need to use the full ...
user avatar
6 votes
Accepted

How can I dynamically load a static resource image in LWC?

I want to thank sfdcfox for his answer. Officially, dynamic resource loading is not supported. But I threw together a hack in case others need a similar solution. Setup Let's say you have a specific ...
user avatar
5 votes
Accepted

Fetch image from Rich Text Field

Where did you get your accessToken from? If you used OAuth to establish the session then you will need to have the web OAuth scope to use the sessionid for what is essentially a screen scraping web ...
user avatar
5 votes
Accepted

Adding an image from a document tab to email template?

open document tab,and image what u want to display,right click on image copy and paste it in <apex:image > <messaging:emailTemplate subject="vf template" recipientType="Contact" > &...
user avatar
  • 716
5 votes
Accepted

How to put large inline images into rich text field using content

When a user uploads images in RichTextArea field salesforce creates this kind of link and ContentReference is maintained by Salesforce internally, which is not accessible by an user using the refid. &...
user avatar
5 votes
Accepted

Display image which is stored in files

Try this format <apex:image url="/sfc/servlet.shepherd/version/download/[DOWNLOADID]"/>. How to get the DOWNLOADID? Open the File, you will get a screen as below. Hover on the download link, ...
user avatar
  • 12.7k
5 votes
Accepted

how to add background image to lightning

You need to specify some content and/or a height in order for this to work. I tweaked your code slightly to display the image as a background image: <div style="{!'position: relative; height: 30vh;...
user avatar
  • 430k
5 votes
Accepted

REST api to upload multiple notes and attachments at once

Yes, there are a few ways to upload files. You can use the API you referenced in your question (the "create new records" API), and you can also upload using a multipart upload. For the first ...
user avatar
  • 430k
5 votes

Displaying Images on Visualforce pages using Base64 Blob

Figured it out after debugging a bit more. Blob img; public Object getImg () { List<ContentVersion> bodyList = [SELECT VersionData FROM ContentVersion WHERE ContentDocumentId='insert your ...
user avatar
  • 175
5 votes
Accepted

How to export the bulk of images in content in salesforce marketing cloud?

There is no easy way to export images from SFMC, it is likely an effort to keep users on platform instead of moving to another service. What I would recommend to pull bulk sets of images is via the ...
user avatar
  • 27.9k
5 votes
Accepted

How to display image from ContentVersion object in Lightning Web Component

There are several options to implement it. If you know ContentVersion Id, you could just create a link and include img tag with src attribute to that link. Another option to query for VersionData ...
user avatar
  • 13.2k
4 votes

Adding an image from a document tab to email template?

You need to pass organization id while referring externally available image in your email document and url is also bit different which you use while referring the document. <messaging:...
user avatar
  • 10.3k
4 votes
Accepted

Hosting images in SFMC - is it a good idea?

Keep in mind, that FTP is just a way of uploading your assets to a web server. Not a specific web server type. SFMC uses Akamai for serving images, and being a CDN, it offers an optimised way of ...
user avatar
  • 16.9k
4 votes

How can I dynamically load a static resource image in LWC?

Adding my two cents. In a recent project I was working on, I was iterating over a list of products, which I wanted to display to the user (including the image). The parent lightning web component was ...
user avatar
4 votes
Accepted

My visualforce PDF does not render webp image

PDF does not support webp, and Flying Saucer, the PDF renderer for Salesforce (and other programs), does not support webp; it would need to translate the webp file into a JPEG file to be usable in PDF....
user avatar
  • 430k
3 votes

Display images from Salesforce Document folder

You can perform a query on the document object. Something like this: public Document doc; public void setDocument(){ this.doc = [Select Id from Document d where d.DeveloperName = '...
user avatar
  • 1,655
3 votes
Accepted

Difference between servlet.imageserver and servlet.filedownload

The first URL allows us only to view the image in browser window while the download ,downloads the file from your browser to download location .
user avatar
3 votes

Visualforce background image

Change url("Image/StayConnected.jpg"); to url("{!URLFOR($Resource.Image, 'Image/StayConnected.jpg')}");
user avatar
  • 5,598
3 votes

Display different VF Pages depending on field's value

Using several pages and the rendered attribute, you could do this relatively easily. Simplest form of that would look like this: <apex:page standardController="Lead" ...> <apex:include ...
user avatar
  • 19.1k
3 votes
Accepted

Render different image depending on Case Status

Not sure how big the image you're wanting to render is, but if is simply an icon you could first consider a simple formula field that renders an image in the details panel for the case that is in ...
user avatar
  • 1,687
3 votes
Accepted

Using APEX variable to preview an image in visualforce page

You are already in a Visualforce expression because of the outer url="{! ... }" so should able to use simple string concatenation: <apex:image url="{! URLFOR($Resource.Apex_Icons, Object_A.Icon__c ...
user avatar
  • 129k
3 votes
Accepted

Displaying attachments on visual force page

Try using this : <apex:repeat value="{!Case.attachments}" var="att"> <apex:panelgrid columns="1"> <h1>Image/h1> <apex:image url="{!...
user avatar
  • 2,217
3 votes
Accepted

How can I display a document image in a VisualForce page so it works in a managed package?

No, the ID will not remain the same. You'll need to find the document by using a query, either embedded in a controller, custom label, or custom setting, or by using JavaScript. There's no good way to ...
user avatar
  • 430k

Only top scored, non community-wiki answers of a minimum length are eligible