{ "id": "172164", "key": "AC-5873", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "11", "description": "Is not a bug in our product", "name": "Not Our Bug" }, "resolutiondate": "2018-10-24T20:16:58.000+0000", "created": "2018-09-03T11:01:54.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2019-03-11T17:14:16.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [], "description": "If take a photo from camera or select one from photoGallery the selected image will be rotated\r\n\r\n{code:javascript}\r\nconst window = Ti.UI.createWindow();\r\n\r\n\tconst imageView = Ti.UI.createImageView({\r\n\t\ttop : 0\r\n\t});\r\n\r\n\tconst cameraButton = Ti.UI.createButton({\r\n\t\ttitle : \"Camera\",\r\n\t\tbackgroundColor : \"teal\",\r\n\t\tcolor : \"white\",\r\n\t\twidth : \"49%\",\r\n\t\tleft : 0,\r\n\t\tbottom : 0\r\n\t});\r\n\r\n\tcameraButton.addEventListener('click', function(e) {\r\n\t\tTi.Media.showCamera({\r\n\t\t\tmediaTypes : [Titanium.Media.MEDIA_TYPE_PHOTO],\r\n\t\t\tsuccess : function(event) {\r\n\t\t\t\timageView.image = event.media;\r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n\r\n\tconst galleryButton = Ti.UI.createButton({\r\n\t\ttitle : \"Gallery\",\r\n\t\tbackgroundColor : \"cyan\",\r\n\t\tcolor : \"white\",\r\n\t\twidth : \"49%\",\r\n\t\tright : 0,\r\n\t\tbottom : 0\r\n\t});\r\n\r\n\tgalleryButton.addEventListener('click', function(e) {\r\n\t\tif (!Ti.Android.hasPermission(\"android.permission.READ_EXTERNAL_STORAGE\")) {\r\n\t\t\tTi.Android.requestPermissions(\"android.permission.READ_EXTERNAL_STORAGE\", function(p) {\r\n\t\t\t\tif (p.success) {\r\n\t\t\t\t\tTitanium.Media.openPhotoGallery({\r\n\t\t\t\t\t\tsuccess : function(event) {\r\n\t\t\t\t\t\t\timageView.image = event.media;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\tTitanium.Media.openPhotoGallery({\r\n\t\t\t\tsuccess : function(event) {\r\n\t\t\t\t\timageView.image = event.media;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\t\r\n\twindow.add(imageView);\r\n\twindow.add(cameraButton);\r\n\twindow.add(galleryButton);\r\n\twindow.open();\r\n{code}", "attachment": [], "flagged": false, "summary": "Android: Camera and PhotoGallery rotate the selected media Image", "creator": { "name": "ahmed.mohamed20320", "key": "ahmed.mohamed20320", "displayName": "Ahmed Mohamed", "active": true, "timeZone": "Africa/Cairo" }, "subtasks": [], "reporter": { "name": "ahmed.mohamed20320", "key": "ahmed.mohamed20320", "displayName": "Ahmed Mohamed", "active": true, "timeZone": "Africa/Cairo" }, "environment": null, "comment": { "comments": [ { "id": "441289", "author": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Hello ,\r\n\r\nThanks for sharing with us. In which device you are experiencing this? Please share your environment details and a screenshot which displays the issue.", "updateAuthor": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2018-09-04T06:26:50.000+0000", "updated": "2018-09-04T06:26:50.000+0000" }, { "id": "441307", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "You need to set the {{ImageView.autorotate}} property to {{true}}. The will allow the {{ImageView}} to read the JPEG's EXIF info to see if it needs to be rotated.\r\nhttps://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.ImageView-property-autorotate\r\n\r\nFor example...\r\n{code:javascript}\r\nconst imageView = Ti.UI.createImageView({\r\n\ttop : 0,\r\n\tautorotate : true, // <- Add this.\r\n});\r\n{code}\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-09-04T16:22:01.000+0000", "updated": "2018-09-04T16:22:01.000+0000" }, { "id": "441311", "author": { "name": "ahmed.mohamed20320", "key": "ahmed.mohamed20320", "displayName": "Ahmed Mohamed", "active": true, "timeZone": "Africa/Cairo" }, "body": "Hey Joshua, I want to upload the selected photo to server. So I want to fix the rotation before uploading.\r\nOr just know the rotation degree to rotate it with ti.imagefactory module.", "updateAuthor": { "name": "ahmed.mohamed20320", "key": "ahmed.mohamed20320", "displayName": "Ahmed Mohamed", "active": true, "timeZone": "Africa/Cairo" }, "created": "2018-09-04T18:10:10.000+0000", "updated": "2018-09-04T18:10:10.000+0000" }, { "id": "441312", "author": { "name": "ahmed.mohamed20320", "key": "ahmed.mohamed20320", "displayName": "Ahmed Mohamed", "active": true, "timeZone": "Africa/Cairo" }, "body": "Also your solution doesn't work if I take the photo from camera. it worked if I select the photo from Gallery.", "updateAuthor": { "name": "ahmed.mohamed20320", "key": "ahmed.mohamed20320", "displayName": "Ahmed Mohamed", "active": true, "timeZone": "Africa/Cairo" }, "created": "2018-09-04T18:14:06.000+0000", "updated": "2018-09-04T18:14:06.000+0000" }, { "id": "441314", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Let me help explain what's going on.\r\n\r\nWhen you take a photo with a camera, it'll take a picture relative to the camera's physical mounted orientation. The camera app, using sensors, will then detect what upright orientation you are holding the device at and will then either do one of the following:\r\n# Save the photo at the camera's mounted orientation and set the JPEG's EXIF orientation to what upright orientation you were holding the camera at.\r\n# Save to JPEG already rotated to the orientation you held the camera at, in which case, the JPEG's EXIF orientation will always set to a zero rotation setting.\r\n\r\nI find that this is device dependent. Some cameras will pre-rotate the photo before saving it to JPEG, some will not and set the EXIF orientation instead and expect the app to rotate it. You cannot control this. In fact, this is normal for actual cameras (not smart phones).\r\n\r\nI've tested {{ImageView.autorotate}} with a device that does not pre-rotate the JPEG. It definitely rotates the image onscreen. But note that we're not changing the JPEG. We're rotating the image onscreen, which is exactly how it works in iOS and Windows apps.\r\n\r\nWe don't have an API that'll create a new JPEG with upright orientation. I suppose what you can do instead is display the photo in an {{ImageView}} and then take a screenshot of it view {{ImageView.toImage()}}, but the major downside to this is that you cannot retain the original resolution of the photo. In order to take a screenshot reliably, you have to shrink the image to fit within the bounds of the screen before saving a new JPEG and odds are it's going to be much smaller than the original.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-09-04T18:38:54.000+0000", "updated": "2018-09-04T18:38:54.000+0000" }, { "id": "446723", "author": { "name": "ahmed.mohamed20320", "key": "ahmed.mohamed20320", "displayName": "Ahmed Mohamed", "active": true, "timeZone": "Africa/Cairo" }, "body": "Hey @Joshua today i submit PR to ti.imagefactory for fixing this issue\r\nPR https://github.com/appcelerator-modules/ti.imagefactory/pull/32", "updateAuthor": { "name": "ahmed.mohamed20320", "key": "ahmed.mohamed20320", "displayName": "Ahmed Mohamed", "active": true, "timeZone": "Africa/Cairo" }, "created": "2019-03-11T17:14:16.000+0000", "updated": "2019-03-11T17:14:16.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }