I have an image at this link: http://d38daqc8ucuvuv.cloudfront.net/avatars/216/2014-02-19%2017.13.48.jpg
As you can see, this is a normal image with correct orientat
You can use Exif-JS , to check the "Orientation" property of the image. Then apply a css transform as needed.
EXIF.getData(imageElement, function() { var orientation = EXIF.getTag(this, "Orientation"); if(orientation == 6) $(imageElement).css('transform', 'rotate(90deg)') });