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
Peter Martensen 8Peter Martensen 8 

I need help with an image link in a Visualforce page

I have a VF page that creates a pdf with an outdated image link.  I can't find the image in my org, so I want to change the link to a known image.  This is the current code:
<td style="border:1px solid black; width: 33%;">
                  <apex:image id="logo" url="{!URLFOR($Resource.avistalogo)}" width="100%"/>
               </td>
This is the current document File location:
https://cambrex--scpq.my.salesforce.com/06961000006G2t9?retUrl=%2F_ui%2Fcore%2Fchatter%2Ffiles%2FFileTabPage
And this is the location if I preview the file, then right click the image, then copy the image location, the paste it into a browser window:
https://cambrex--scpq--c.cs30.content.force.com/sfc/servlet.shepherd/version/renditionDownload?rendition=ORIGINAL_Png&versionId=06861000006j6b4&operationContext=CHATTER&contentId=05T6100000JxdqP
Can someone help me get that image to show up on the pdf that the VF page creates?  I can also give the location in the old Classic Documents folder, but I thought I'd try with the new Files location first.  The file is currently a png file, or does it need to be a jpg file?
Thanks


 
Deepali KulshresthaDeepali Kulshrestha
Hi Peter,

Protect your users from unauthorized requests by using the IMAGEPROXYURL function to securely fetch images outside your org’s server. Loading a third-party image can initiate a malicious authentication request meant to steal Salesforce usernames and passwords. This Visualforce function loads external images over HTTPS and prevents images from requesting user credentials.Include the IMAGEPROXYURL function on the src attribute of a <img> tag or the valueattribute of an <apex:image> object.Please refere to the following code as it may be helpful in solving your query:
<apex:page standardController="Contact" >
    <apex:image id="salesforce-twitter"  value="https://pbs.twimg.com/profile_images/1014182734606897153/JfveQU3Z_400x400.jpg"     alt="Salesforce on Twitter" />
</apex:page>
For more information on IMAGEPROXYURL please go through the following link:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_image.htm

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha