2

I have a image of about 3264 by 2448 captured by iPhone 5s, When I upload it to my server and use PHPthumb to generate its thumbnail it automatically rotates to 90 degree left

I've done too much RND but nothing helpful found please let me know if anyone faced same issue, there's nothing special in code and it happens for that image only.

And it also show 90 degree left in preview but original image uploaded is fine problem is with thumbnail only.

1 Answers1

1

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.

rhens
  • 4,791
  • 3
  • 22
  • 38