Most recent phone cameras have created an EXIF file with photos that note photo orientation. Some phones and all older photo software does not read the files so just display the photo as stored. To ensure your pics display correctly in both always hold your phone with the shutter button at the bottom(portrait format pic) or to the right(landscape format).