In any case, images should no longer upload onto the site and show sideways (or worse) when they were taken that way.
Avatars work differently, and I'll still have to work on that one a bit more.
1:16 am, time to call it a night!

The problem is modern digital cameras and smartphones have orientation sensors, so they know which way the camera was turned when the picture was taken. But instead of actually rotating the image when it is written to the memory, it writes out a regular "landscape" image - and then inserts data into the header of the image (called EXIF data, if you care) saying "rotate the image THIS way when it is displayed."