[FreddysHouse] Photo Rotate [Deleted]


Well-known member
SheepCow submitted a new resource:

[FreddysHouse] Photo Rotate - Rotates photos from camera, mobile phones, etc.

Scans EXIF in image uploads and rotates images as required to put them in the correct orientation.

Some orientations require imageflip (available from PHP 5.5.0 and up), but they're the pretty unusual ones.

Uses the PHP GD library to rotate images, it is lossy.

This has been lightly tested ;)
Read more about this resource...


Well-known member
Once again, thanks so much for this add-on, @SheepCow. I don't understand why every XenForo admin wouldn't be rushing to install this.

Although this did work, unfortunately, it has generated a lot of errors in my error log, and prevented many users from uploading pictures altogether. Here's a stack trace from my logs:

ErrorException: exif_read_data(phprqAGfq): Illegal IFD size: x0002 + 2 + x4949*12 = x36F6E > x02C3 - library/FreddysHouse/PhotoRotate/DataWriter/AttachmentData.php:67
Generated By: Dragon, Today at 11:06 AM
Stack Trace
#0 [internal function]: XenForo_Application::handlePhpError(2, 'exif_read_data(...', '/home/...', 67, Array)
#1 /home/public/forum/library/FreddysHouse/PhotoRotate/DataWriter/AttachmentData.php(67): exif_read_data('/tmp/phprqAGfq')
#2 /home/public/forum/library/FreddysHouse/PhotoRotate/DataWriter/AttachmentData.php(19): FreddysHouse_PhotoRotate_DataWriter_AttachmentData->_rotateIfRequired()
#3 /home/public/forum/library/XenForo/DataWriter.php(1434): FreddysHouse_PhotoRotate_DataWriter_AttachmentData->_preSave()
#4 /home/public/forum/library/XenForo/DataWriter.php(1373): XenForo_DataWriter->preSave()
#5 /home/public/forum/library/XenForo/Model/Attachment.php(524): XenForo_DataWriter->save()
#6 /home/public/forum/library/XenForo/ControllerPublic/Attachment.php(201): XenForo_Model_Attachment->insertUploadedAttachmentData(Object(XenForo_Upload), 203954)
#7 /home/public/forum/library/XenForo/FrontController.php(337): XenForo_ControllerPublic_Attachment->actionDoUpload()
#8 /home/public/forum/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#9 /home/public/forum/index.php(13): XenForo_FrontController->run()
#10 {main}
Request State
array(3) {
["url"] => string(112) "http://www.example.com/forum/attachments/do-upload.json?hash=35d2ca2d6a6864a3f37f47971e16e710&content_type=post"
["_GET"] => array(3) {
["/forum/attachments/do-upload_json"] => string(0) ""
["hash"] => string(32) "35d2ca2d6a6864a3f37f47971e16e710"
["content_type"] => string(4) "post"
["_POST"] => array(7) {
["Filename"] => string(23) "Deep Forest Raceway.jpg"
["_xfResponseType"] => string(4) "json"
["_xfNoRedirect"] => string(1) "1"
["_xfSessionId"] => string(32) "78b4b84aad9be01544ffc3c8a730702f"
["content_data"] => array(1) {
["thread_id"] => string(6) "235094"
["_xfToken"] => string(8) "********"
["Upload"] => string(12) "Submit Query"
Do you have GD installed and do they have the right EXIF data?
I retested it incl. the bugfix reported by thedude and it doesn't rotate the images.

I tested it with images from htc sensation, Samsung Galaxy S4, Nexus 4 and iPhone 5s.

Could it be that it doesn't work with PHP <5.5.0?