Some of the pictures on this website are taken on a mobile phone. If the phone was held in portrait mode the images were coming out on the website rotated wrongly. Looking at the images on the computer didn't show the problem because the programs handled the rotation behind the scenes.

I had been using the sips Mac system utility to get width and height for images but sips did not report the orientation.

So instead for JPEG images the pre-processor now uses the exifr Ruby gem to get the EXIF data, and if the image is rotated then adjust the width and height accordingly.

In addition the ImageMagick option auto-orient is used so when the images are resized for use on the website the rotation is allowed for.