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 = ...
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 ...
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
...
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="{!...
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 ...
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 ...
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, ...
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 ...
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" >
&...
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.
&...
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, ...
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;...
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 ...
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 ...
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:...
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}"...
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 ...
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 ...
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....
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 ...
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 ...
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:...
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 ...
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%"/>
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 ...
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" ...
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 ...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
images × 254visualforce × 78
apex × 47
marketing-cloud × 29
static-resources × 19
richtextarea × 16
email-template × 15
attachment × 15
lightning-web-components × 14
html × 14
pdf × 13
lightning-aura-components × 12
rest-api × 11
email × 11
css × 10
image-formula × 10
lightning × 9
formula × 9
upload × 9
document × 9
community × 8
url × 8
files × 7
javascript × 5
ampscript × 5