CodeIgniter Forums
image turning from portrait to landscape when resizing - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: image turning from portrait to landscape when resizing (/showthread.php?tid=17342)



image turning from portrait to landscape when resizing - El Forum - 04-02-2009

[eluser]jaume[/eluser]
Any idea on how to avoid this?

I take a picture with my camera and shows as a portrait on the screen, I resize it and becomes landscape oriented... the mystery is served! Wink


image turning from portrait to landscape when resizing - El Forum - 04-02-2009

[eluser]jedd[/eluser]
Your resizing software is broken. It is resetting the Orientation component of your EXIF data.

Solution - get a better bit of software. ImageMagick is a good candidate.


EDIT: actually, I cheat with this - as part of my after-shoot processing, I adjust the physical orientation of all my shots to the appropriate angle (eg. jpegrotate), and then I run a jpegexiforient script across the lot that sets the exif orientation to top-left. I really hate having to deal with image orientation issues, and this solves the problem forever.


image turning from portrait to landscape when resizing - El Forum - 04-02-2009

[eluser]jaume[/eluser]
GD 2.3.5 is broken?!


image turning from portrait to landscape when resizing - El Forum - 04-02-2009

[eluser]jaume[/eluser]
do you know a way to read the exif orientation from php and set it again after resizing to avoid this problem?


image turning from portrait to landscape when resizing - El Forum - 04-02-2009

[eluser]jedd[/eluser]
Reading EXIF data from within PHP is the easy bit. Writing it back again is impossible AFAIK (I looked for this a while ago, as I wanted to create cache images on the fly, and replicate the whole EXIF data into them). You can of course do system() calls out to binaries, and this is what I ended up doing.

This comes down to what operating system you're running more than anything else. If you've got a real OS, it's very easy. I use ImageMagick's convert , which seems to copy across the whole EXIF chunk as it goes. And I use Guido Vollbeding's exifautotran to transform and convert orientation back to '1' (top-left).


image turning from portrait to landscape when resizing - El Forum - 04-08-2009

[eluser]jaume[/eluser]
I've got a REAL Ubuntu! Wink I'll check it out. Thanks!