{ "id": "172705", "key": "TIMOB-26631", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2019-01-02T20:11:55.000+0000", "created": "2018-12-05T17:02:10.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [ { "id": "20238", "description": "", "name": "Release 7.5.0", "archived": false, "released": true, "releaseDate": "2018-11-15" } ], "issuelinks": [], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2019-01-02T20:11:59.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "Hello!\r\nI'm trying to take an image from the camera and then save it to the image view or post it to my server for Android. The problem is when I take the image it gets rotated to 90 degrees.\r\n\r\nTest Code:\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor: '#fff',\r\n\ttitle: 'Test',\r\n\tlayout:\"vertical\"\r\n});\r\n \r\nvar button = Ti.UI.createButton({\r\n\ttitle: 'Post Item'\r\n});\r\n \r\nbutton.addEventListener('click', function(e) {\r\n\tvar dialog = Ti.UI.createOptionDialog({\r\n\t\toptions: ['Take a Picture', 'Choose a Picture'],\r\n\t\tcancel: 2\r\n\t});\r\n\t\t\t\t\r\n\tdialog.addEventListener('click', function(e) {\r\n\t\tif(e.index == 0) {\r\n\t\t\tTi.Media.showCamera({\r\n\t\t\t\tsuccess: function(e) {\r\n\t\t\t\t\talert('media.nativePath: ' + e.media.nativePath);\r\n\t\t\t\t\t// create an imageView to display our photo\r\n\t\t var imageView = Ti.UI.createImageView({\r\n\t\t image: e.media\r\n\t\t });\r\n\t\t \r\n\t\t // add the imageView to the window\r\n\t\t win.add(imageView);\r\n\t\t\t\t},\r\n\t\t\t\tcancel: function(e) {\r\n\t\t\t\t\tTi.API.info(JSON.stringify(e));\r\n\t\t\t\t},\r\n\t\t\t\terror: function(e) {\r\n\t\t\t\t\tTi.API.info(JSON.stringify(e));\r\n\t\t\t\t},\r\n\t\t\t\tanimated: false,\r\n\t\t\t\tautohide: true,\r\n\t\t\t\tsaveToPhotoGallery: false,\r\n\t\t\t\tshowControls: true\r\n\t\t\t});\r\n\t\t\t\r\n\t\t}\r\n\t\telse if(e.index == 1) {\r\n\t\t\tTi.Media.openPhotoGallery({\r\n\t\t\t\tsuccess: function(e) {\r\n\t\t\t\t\talert('media.nativePath: ' + e.media.nativePath);\r\n\t\t\t\t},\r\n\t\t\t\tcancel: function(e) {\r\n\t\t\t\t\tTi.API.info(JSON.stringify(e));\r\n\t\t\t\t},\r\n\t\t\t\terror: function(e) {\r\n\t\t\t\t\tTi.API.info(JSON.stringify(e));\r\n\t\t\t\t},\r\n\t\t\t\tmediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO]\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\t\r\n\tdialog.show();\r\n});\r\n \r\nwin.add(button);\r\n\r\n//check if we already have permissions to capture media\r\nif (!Ti.Media.hasCameraPermissions()) {\r\n\r\n // request permissions to capture media\r\n Ti.Media.requestCameraPermissions(function (e) {\r\n\r\n // success! display the camera\r\n if (e.success) {\r\n \twin.open();\r\n\r\n // oops! could not obtain required permissions\r\n } else {\r\n callback(new Error('could not obtain camera permissions!'), null);\r\n }\r\n });\r\n} else {\r\n\twin.open();\r\n}\r\n{code}\r\n\r\nTets Environment:\r\n{code}\r\nOperating System\r\n Name = Microsoft Windows 10 Pro\r\n Version = 10.0.17134\r\n Architecture = 32bit\r\n # CPUs = 4\r\n Memory = 17091956736\r\nNode.js\r\n Node.js Version = 8.9.1\r\n npm Version = 5.5.1\r\nTitanium CLI\r\n CLI Version = 5.1.1\r\nTitanium SDK\r\n SDK Version = 7.5.0.GA\r\n SDK Path = C:\\ProgramData\\Titanium\\mobilesdk\\win32\\7.5.0.GA\r\n Target Platform = android\r\n{code}\r\n\r\nPlease take a look on attached screenshot. Also note, that front and back facing cameras rotate the image different ways\r\n\r\n\r\n\r\n\r\nThanks \r\n", "attachment": [ { "id": "65949", "filename": "Screen Shot 2018-12-05 at 10.21.46 AM.png", "author": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "created": "2018-12-05T17:02:00.000+0000", "size": 342279, "mimeType": "image/png" }, { "id": "65948", "filename": "Screen Shot 2018-12-05 at 10.22.11 AM.png", "author": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "created": "2018-12-05T17:01:56.000+0000", "size": 306377, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: image from camera gets rotated to 90 degree ", "creator": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "subtasks": [], "reporter": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "environment": "Operating System\r\n Name = Microsoft Windows 10 Pro\r\n Version = 10.0.17134\r\n Architecture = 32bit\r\n # CPUs = 4\r\n Memory = 17091956736\r\nNode.js\r\n Node.js Version = 8.9.1\r\n npm Version = 5.5.1\r\nTitanium CLI\r\n CLI Version = 5.1.1\r\nTitanium SDK\r\n SDK Version = 7.5.0.GA\r\n SDK Path = C:\\ProgramData\\Titanium\\mobilesdk\\win32\\7.5.0.GA\r\n Target Platform = android", "closedSprints": [ { "id": 824, "state": "closed", "name": "2017 Sprint 16 Platform", "startDate": "2017-07-29T00:00:37.248Z", "endDate": "2017-08-12T00:00:00.000Z", "completeDate": "2019-03-14T20:37:14.311Z", "originBoardId": 200 } ], "comment": { "comments": [ { "id": "444283", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "You need to set {{ImageView}} property \"autorotate\" to {{true}}. Please see...\r\nhttps://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.ImageView-property-autorotate\r\n\r\nThe reason this is happening is because some cameras will save the JPEG based on the camera's mounted orientation. In this case, the camera will store the orientation the device was held to the JPEG file's EXIF information. When setting \"autorotate\" to {{true}}, the {{ImageView}} will read the JPEG EXIF and rotate the image if needed.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-12-05T18:46:19.000+0000", "updated": "2018-12-05T18:46:19.000+0000" }, { "id": "444286", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This solution works on all phones and Android OS versions I've tested it on. If it's not working for a particular JPEG, then that may suggest that the JPEG does not have the orientation stored to its EXIF.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-12-05T20:09:59.000+0000", "updated": "2018-12-05T20:09:59.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }