it is not so much a glitch in the software here but the actual extra code that facebook uses to post the pictures the correct way because duffes like you cant take a picture straight!!! lol!!!!!
Most phones are set to take the picture in landscape, not portrait. Most phones have info i the header of the picture to indicate the was the picture was taken so the picture is always correct.