Most photographs have extra information embedded in them (known as 'meta data' or 'EXIF data') that contains details about how and where the photograph was taken. These details include various camera settings including, crucially, the camera orientation (portrait versus landscape).
This means a photograph in portrait orientation will actually be stored in landscape format, but software that understands this 'meta data' will automatically rotate the image back to portrait format when the photograph is viewed or opened.
This can be a problem if old software is used to edit the image. If the photograph is opened in a programme that does not understand orientation meta data saying "picture should be rotated 90 degrees clockwise" then it will show the photo unrotated, i.e. on its side. The person editing the picture will then rotate it 90 degrees, so it now looks correct to them, but the old editing software does not remove the meta data when saving the rotated image, so the image still includes the instruction to rotate the photo 90 degrees.
Now, if an iPhone or other modern devices that does understand orientation meta data loads the image, the photo is already stored in the correct orientation but still with the meta data saying "picture should be rotated 90 degrees clockwise", so the picture ends up displaying on its side.
Any image that is edited before being uploaded for use on the website should be saved without its meta/EXIF data; this option is sometimes labelled in software as something like 'save ready for web'.
We are not able to offer detailed advice on programmes for image management or editing, but there are many excellent online resources that list and review image-editing software. There are also a number of web-based photo-editing services, including one called Pixlr, for which we have instructions on how to resize and crop photographs.