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
Jessi McPeekJessi McPeek 

How to tell if image has been rotated by Salesforce File (Content Version) Object

I have users attaching images that are to be pushed through an API to an outside website. We are currently attaching the images as files in the related list to our custom object. However these files will sometimes auto rotate on the view so they appear to be uploaded in the correct orientation (for example a picture of a person is showing in portrait, but is saved as a landscape), but when the file is downloaded it is showing in the landscape orientation, making it push to our outside site as a landscape photograph. We are accessing the image through the content version object.

Is there a way to tell if the view of the image is different than the original file orientation? 

Is there a way to change the orientation of the image programmaticaly so that is is stored in the correct orientation? 
for(ContentDocumentLink doclink : [select id, ContentDocumentId from contentdocumentlink where LinkedEntityId = :sObject.id Limit 1])
{
    for(ContentDocument img : [Select id, title, fileExtension, Createddate from ContentDocument 
                               where id =:doclink.ContentDocumentId and 
                               (fileExtension = 'jpg' or fileExtension = 'jpeg'or fileExtension ='png' or fileExtension = 'gif')
                               order by CreatedDate asc Limit 1])
    {
        for(ContentVersion version : [Select versionData, PathOnClient  from contentVersion where ContentDocumentId =: img.id])
        {
            
            Blob image = version.versionData;             
        }
    }
}
Anil Meghnathi 6Anil Meghnathi 6
Jessi, 

We are facing same issue. 

Did you find any solution for these? 

Thanks in advance.