{"action":"created","issue":{"url":"https://api.github.com/repos/sconsult/croppic/issues/145","labels_url":"https://api.github.com/repos/sconsult/croppic/issues/145/labels{/name}","comments_url":"https://api.github.com/repos/sconsult/croppic/issues/145/comments","events_url":"https://api.github.com/repos/sconsult/croppic/issues/145/events","html_url":"https://github.com/sconsult/croppic/issues/145","id":97077202,"number":145,"title":"Distorsion when upload from mobile (ios)","user":{"login":"zazzz","id":13485921,"avatar_url":"https://avatars.githubusercontent.com/u/13485921?v=3","gravatar_id":"","url":"https://api.github.com/users/zazzz","html_url":"https://github.com/zazzz","followers_url":"https://api.github.com/users/zazzz/followers","following_url":"https://api.github.com/users/zazzz/following{/other_user}","gists_url":"https://api.github.com/users/zazzz/gists{/gist_id}","starred_url":"https://api.github.com/users/zazzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zazzz/subscriptions","organizations_url":"https://api.github.com/users/zazzz/orgs","repos_url":"https://api.github.com/users/zazzz/repos","events_url":"https://api.github.com/users/zazzz/events{/privacy}","received_events_url":"https://api.github.com/users/zazzz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sconsult/croppic/labels/confirmed%20for%20development","name":"confirmed for development","color":"bfe5bf"},{"url":"https://api.github.com/repos/sconsult/croppic/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-07-24T15:26:46Z","updated_at":"2015-09-09T19:19:45Z","closed_at":null,"body":"Hi, \r\n\r\nI'm currently developping a web app and I use your script.\r\nBut I took it without making some tests on my phone.\r\nAnd now, i just saw a problem. When I upload an image from my image library (ios), the image is crashed, distorted. \r\nI don't know why because it's just a simple upload with an ajax request. \r\n\r\nThen, when i crop the image, it'll be rotated automatically...\r\n\r\nIt's a problem from my code or not expected in your script ? \r\n\r\nThanks for you time in advance, \r\n\r\nzazzz "},"comment":{"url":"https://api.github.com/repos/sconsult/croppic/issues/comments/139019739","html_url":"https://github.com/sconsult/croppic/issues/145#issuecomment-139019739","issue_url":"https://api.github.com/repos/sconsult/croppic/issues/145","id":139019739,"user":{"login":"JLGouwy","id":3371103,"avatar_url":"https://avatars.githubusercontent.com/u/3371103?v=3","gravatar_id":"","url":"https://api.github.com/users/JLGouwy","html_url":"https://github.com/JLGouwy","followers_url":"https://api.github.com/users/JLGouwy/followers","following_url":"https://api.github.com/users/JLGouwy/following{/other_user}","gists_url":"https://api.github.com/users/JLGouwy/gists{/gist_id}","starred_url":"https://api.github.com/users/JLGouwy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JLGouwy/subscriptions","organizations_url":"https://api.github.com/users/JLGouwy/orgs","repos_url":"https://api.github.com/users/JLGouwy/repos","events_url":"https://api.github.com/users/JLGouwy/events{/privacy}","received_events_url":"https://api.github.com/users/JLGouwy/received_events","type":"User","site_admin":false},"created_at":"2015-09-09T19:19:45Z","updated_at":"2015-09-09T19:19:45Z","body":"At the moment where you upload the image on your server. \r\nIf you took the example of croppic, it's img_save_to_file.php , before move_uploaded_file().\r\n\r\nThe main part of my code is : \r\n```php\r\n$exif = exif_read_data($filename);\r\n                    if (isset($exif['Orientation']))\r\n                    {\r\n                        switch ($exif['Orientation'])\r\n                        {\r\n                            case 3:\r\n                                // Need to rotate 180 deg\r\n                                $source = imagecreatefromjpeg($filename);\r\n                                $rotate = imagerotate($source, -180, 0);\r\n                                imagejpeg($rotate, $filename);\r\n                                break;\r\n\r\n                            case 6:\r\n                                // Need to rotate 90 deg clockwise\r\n                                $source = imagecreatefromjpeg($filename);\r\n                                $rotate = imagerotate($source, -90, 0);\r\n                                imagejpeg($rotate, $filename);\r\n                                break;\r\n\r\n                            case 8:\r\n                                // Need to rotate 90 deg counter clockwise\r\n                                $source = imagecreatefromjpeg($filename);\r\n                                $rotate = imagerotate($source, 90, 0);\r\n                                imagejpeg($rotate, $filename);\r\n                                break;\r\n                        }\r\n                    }\r\n                    list($width, $height) = getimagesize($filename);\r\n"}}