Certain images cause wrong orientation on previews

For some images, a landscape preview is generated, even though it is a portrait picture and Mac displays it correctly as a portrait picture. I've attached uploaded the picture to oae-community as it is too big to attach here (https://oae-community.sakaiproject.org/content#p=pm4L7wKxaa/IMG_0024.JPG).

Note that community seems to be having the same issue with these files.