0

When I get the URL for the saved image in Salesforce and viewed it shows the image as it is. Suppose below is the URL we get:

{instanceURl}/CSVerification/servlet/servlet.FileDownload?file=00P0S0000021IpKUAU

But when I use the same URL in Rich Text Area field of an object as mentioned below:

<img alt="applicationImage" src="{instanceURL}/CSVerification/servlet/servlet.FileDownload?file=00P0S0000021IpKUAU">

Image is getting displayed but not the original one, It's getting displayed in landscape mode (rotated left by 90deg).

Why image not getting displayed as it displays with URL in Rich Text Area?

1 Answer 1

1

This problem is caused by the EXIF extension in this article, combined with the fact that apparently image-rotation is, by default, 0deg, so any compliant browser isn't allowed to show the image right-side-up.

The only fix for this is to reorient the image properly by using an image manipulation algorithm capable of reordering the pixels in the file, such as using an HTML canvas in JavaScript, or by using a tool such as ImageMagick. This needs to be done before the HTML is saved to the RTA field, because a copy of the file is made at that point in time, so further changes won't be reflected in that field. There is no reliable fix other than to reorient the image, or take the image "right side up" with your camera.

3
  • Thanks sfdcfox, yes even I think in the same way. But can we display that image rotated on pdf as a workaround? As rotate also don't work for visualforce pages rendered as pdf. Commented Sep 17, 2019 at 15:32
  • @Vinod I'm pretty sure that won't be supported. You need to rotate the image correctly before uploading.
    – sfdcfox
    Commented Sep 17, 2019 at 16:29
  • Can I rotate that image and display it on visualforce page rendered as pdf? Commented Sep 17, 2019 at 16:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .