I am encountering a problem using imagefield crop together with imagecache actions autorotate. When my users upload images with iPhone or iPad, imagecache autorotate automatically reads EXIF data and gives the image the correct orientation (i.e. portrait or landscape). However, when I am using imagefield crop widget to upload these images, the thumbnail in the node edit screen has correct orientation, however the output after cropping is rotated 90 degrees.
After extensive searching, there is a common problem with correcting the orientation of iPhone and iPad image uploads using autorotate. However, it seems as though when you use imagefield crop as well, it does not work.
From my research, my hunch is that imagefield crop somehow modifies/deletes the EXIF data of the original uploaded image, and therefore the autorotate operation does not know how to correctly orient the resulting image.
Please let me know if I can help in any way, as I've spent quite some time on this with no success. I'm happy to walk people through it on my site if that helps as well. I would add a bounty for this, but not sure how.
Much thanks!
Comments
Comment #1
joetsuihk commentedThis is marginally a bug. imagefield_crop 7.x use drupal's default image_crop and image_scale_and_crop function.
So it is actually Drupal core who removed the exif.
Further digging, ImageMagick seems can preserve exif data: http://drupal.org/node/1663518
So you may try that. Please report back if ImageMagick does work.
Comment #2
jcsnyder commentedHi joetsuihk,
Thanks a lot for your reply. I installed imagemagick to try it. Long story short, it is handling the orientation of iPhone/iPad images correctly now. However, it is still encountering problems cropping portrait images when cropping off the top of the image.
John
Comment #3
joetsuihk commentedCan you open a new issue or edit the issue title for "problems cropping portrait images when cropping off the top of the image"?
Can you describe the bug a bit more?
Thanks!
Comment #4
jcsnyder commentedWill do.
To clarify, the bug occurs anytime I am uploading an image from and iPhone or iPad (iOS6) that was taken in portrait mode. I am using Imagefield Crop with GD image-toolkit and Imagecache Actions Autorotate. Though you have to set the crop area such that the top of the image is cropped off in order to see the bug, it is just a coincidence that it works when you don't crop off the top, and therefore still considered a bug anytime in portrait mode.
The issue can be easily reproduced using imagefield crop, imagecache actions autorotate, and uploading from iphone or ipad. The issue has something to do with the EXIF data, when the autorotate is processed, etc.
Please let me know if I can help in any way or you'd like me to show you the bug in screenshare.
Thanks,
John
Comment #5
Anonymous (not verified) commentedThis issue still exists.
Using the following:
- 7.x-2.0+11-dev
- Jcrop-0.9.12
- ImageMagick
Issue: Photos taken with iPad, iPhone, etc. in Portrait mode are cut off in the crop preview box. Landscape photos work fine.
Comment #6
nlisgo commentedI have fixed this issue and will get round to submitting a patch but here is the updated imagefield_crop_widget_preview_process function
Comment #7
joetsuihk commentedThanks. but we need this to be a patch to be reviewed by the community. Please refer to https://drupal.org/node/209591/git-instructions/7.x-1.x for easy patch creation.
I also suggest wrapping exif_read_data() with function_exists()