Hot answers tagged

12 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 = ...
sfdcfox's user avatar
  • 481k
9 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 ...
Salesforce_Noobie's user avatar
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 ...
Scott Fraser's 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="{!...
Ratan Paul's user avatar
  • 22.5k
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 ...
Mohith Shrivastava's user avatar
7 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 ...
Patlatus's user avatar
  • 16k
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, ...
TheAmigo's user avatar
  • 255
6 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 ...
sfdcfox's user avatar
  • 481k
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" > &...
Satya's user avatar
  • 724
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. &...
Santanu Boral's 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, ...
Saroj Bera's user avatar
  • 14.6k
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;...
sfdcfox's user avatar
  • 481k
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 ...
Illusion's user avatar
  • 185
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 ...
Gortonington's user avatar
  • 30.3k
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:...
Himanshu's user avatar
  • 10.5k
4 votes
Accepted

Render Image from Rich Text Field

You should use the <apex:outputField> tag instead of a naked merge field. Incorrect: <div>{!myRecord.MyField__c}</div> Correct: <apex:outputField value="{!myRecord.MyField__c}"...
Adrian Larson's user avatar
  • 149k
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 ...
Lukas Lunow's user avatar
  • 20.6k
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 ...
Tom Reinman's 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....
sfdcfox's user avatar
  • 481k
4 votes
Accepted

Find the name of an image based on its URL in Marketing Cloud

By far, the easiest method to determine the name from the image URL is to enable Predictive File URLs. If your solution needs to account for images uploaded before the enablement of that feature, or ...
Jason Hanshaw's user avatar
3 votes

Why does one image load but the other doesn't

Because Force.com is CaSe SeNsItIvE. The broken link icon says that it's trying to load Confirm24, but the actual file name is confirm24. Check your formulas and make sure you're using the correct ...
sfdcfox's user avatar
  • 481k
3 votes
Accepted

Get details of Image selected from <apex:inputFile>

Following page utilizes Exchangeable Image File library and apex:inputfile example. Exif.getData function reads GPS data from image and stores it as description in document record. VF: <apex:...
Ilya Lepesh's user avatar
  • 4,115
3 votes
Accepted

Add light indicator on page layout

You can use a formula field to show the images stored in Documents. Please see the below SFSE and Salesforce Help link to get a idea on this. Hope this helps. SFSE Link - How to display the formula ...
Saroj Bera's user avatar
  • 14.6k
3 votes

Image size control in VF Page

You should use apex component, native HTML needs additional processing to be displayed correctly. Try: <apex:image id="theImage" value="{!$Resource.army}" width="25%" height="25%"/>
Ilya Lepesh's user avatar
  • 4,115
3 votes

The location of Rich Text area image repository

If you have id of a record, you can easily find the related object, using describe methods. ID refid='0EM28000000I7Eq'; SYSTEM.DEBUG(refid.getSObjectType().getDescribe().getName()); After ...
Salesforcesmarty's user avatar
3 votes

How to display image in lightning component from ContentDocumentLink

Yes, you can! To give a brief idea how to do that, You have to fetch the ID of the attachment from a server call and store it a aura:attribute. <aura:attribute name="attchid" type="String" ...
Santanu Halder's user avatar
3 votes
Accepted

Identify the image source on Apex:image tag

Salesforce has a bunch of built-in images. While we're not technically suppose to rely on them, many of these images have been around forever and likely won't go away until Classic is no longer ...
sfdcfox's user avatar
  • 481k
3 votes
Accepted

Get base64 of image from rich text field

Its better to save base64 encoded value of Screenshot__c field in new field created in myCustomObject__c object so that you can easily get encoded value and pass to visualforce page. For encoding ...
Reshma's user avatar
  • 3,969
3 votes
Accepted

Is it mandatory to have Assests/Images/CSS present in SFMC?

There is nothing wrong with having the assets hosted outside of SFMC. There is a very small risk of affecting your sender reputation/deliverability, but this risk is negligible. I will however ...
Lukas Lunow's user avatar
  • 20.6k
3 votes

Hosting images in SFMC - is it a good idea?

@LukasLunow is correct that utilizing an 'FTP' instead of a CDN is definitely not best practice. I would change this process immediately, either inside SFMC or inside a new 3rd party CDN service. I ...
Gortonington's user avatar
  • 30.3k

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