If your image is a JPEG, this could be because of EXIF rotation. A lot of cameras have sensors to determine the orientation. Thus a camera detects if you are holding it in portrait or landscape mode (possibly upside down).
This orientation information is stored in the metadata of the image file, so image viewers can take into account any rotation. Some more in-depth explanation about the concept: JPEG Rotation and EXIF Orientation and EXIF Orientation Handling Is a Ghetto. Specifically for iPhone: Why Your iPhone Photos Are Upside Down & How To Fix That
You can test if this is the actual problem with your particular image by using an image viewer that allows you to enable/disable EXIF rotation. In
IrfanView, for example: Options, Properties/Settings, JPG/PCD/GIF tab, "Auto-rotate image according to EXIF info".
It seems phpThumb has support for EXIF orientation. From phpThumb documentation:
ar = Auto Rotate: set to "x" to use EXIF orientation
stored by camera. Can also be set to "l" or "L"
for landscape, or "p" or "P" for portrait. "l"
and "P" rotate the image clockwise, "L" and "p"
rotate the image counter-clockwise.