If you take the picture with a phone or ipad, it stores the direction it thinks is 'up' with the picture. Browsers will read that flag and flip the picture in a direction they think should be 'up' based on the flag. Often, that is sideways or upside down from what it should really be. If you load the picture into an editing software and save an altered version, it gets saved without that rotation flag.