{ "id": "93185", "key": "TIMOB-9528", "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": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2012-06-16T00:07:42.000+0000", "created": "2012-06-13T17:10:52.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "Regression", "core" ], "versions": [ { "id": "13273", "description": "Release 2.0.2", "name": "Release 2.0.2", "archived": false, "released": true, "releaseDate": "2012-05-31" } ], "issuelinks": [], "assignee": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "updated": "2017-03-31T17:17:43.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": "h3. Problem\r\n\r\nCannot Save the images taken by camera on the external directory by this method: Titanium.Filesystem.getFile(Titanium.Filesystem.externalStorageDirectory, 'PlayGroundPhotos');\r\n\r\nThe sample code is here:\r\n\r\n{noformat}\r\nvar win = Titanium.UI.createWindow({\r\n backgroundColor:'white'\r\n});\r\n \r\nTitanium.Media.showCamera({\r\n \r\n success:function(event)\r\n {\r\n var cropRect = event.cropRect;\r\n var image = event.media;\r\n \r\n Ti.API.debug('Our type was: '+event.mediaType);\r\n if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO)\r\n {\r\n /******** capture image in a imageView ********/\r\n \r\n var imageView = Ti.UI.createImageView({ \r\n width:win.width,\r\n height:win.height,\r\n image:event.media\r\n });\r\n win.add(imageView);\r\n \r\n /******** rotate the imageView ************/\r\n \r\n var transformCurrentPicture = Titanium.UI.create2DMatrix();\r\n imageView.addEventListener('click',function(e){\r\n transformCurrentPicture = transformCurrentPicture.rotate(90);\r\n imageView.animate({transform:transformCurrentPicture});\r\n savePhoto('Hello.png',imageView.toBlob()); \r\n });\r\n \r\n \r\n \r\n // savePhoto('Hello',imageView.toBlob()); \r\n }\r\n else\r\n {\r\n alert(\"got the wrong type back =\"+event.mediaType);\r\n }\r\n },\r\n cancel:function()\r\n {\r\n },\r\n error:function(error)\r\n {\r\n // create alert\r\n var a = Titanium.UI.createAlertDialog({title:'Camera'});\r\n \r\n // set message\r\n if (error.code == Titanium.Media.NO_CAMERA)\r\n {\r\n a.setMessage('Please run this test on device');\r\n }\r\n else\r\n {\r\n a.setMessage('Unexpected error: ' + error.code);\r\n }\r\n \r\n // show alert\r\n a.show();\r\n },\r\n saveToPhotoGallery:true,\r\n allowEditing:true,\r\n mediaTypes:[Ti.Media.MEDIA_TYPE_VIDEO,Ti.Media.MEDIA_TYPE_PHOTO]\r\n});\r\n \r\nwin.open();\r\n \r\n/******* function to save the image **********/\r\n \r\nfunction savePhoto(photoName,photoToSave){\r\n var photoPath = '';\r\n var photoDir = ''; \r\n \r\n //Check for photo dir and create if not there \r\n \r\n if (Titanium.Filesystem.isExternalStoragePresent()){ \r\n photoDir = Titanium.Filesystem.getFile(Titanium.Filesystem.externalStorageDirectory, 'PlayGroundPhotos');\r\n if ( ! photoDir.exists()){\r\n photoDir.createDirectory(); \r\n }\r\n }\r\n \r\n //check for photo dir and create if not there locally since no external storage\r\n \r\n else{ \r\n photoDir = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory, 'PlayGroundPhotos');\r\n if ( ! photoDir.exists()) {\r\n photoDir.createDirectory(); \r\n }\r\n else{\r\n alert('photoDir exists');\r\n }\r\n } \r\n \r\n //At this point we know if SD card exists and have created photo directory if needed\r\n \r\n photoPath = photoDir.nativePath;\r\n alert('The photopath is: '+photoPath);\r\n var f = Titanium.Filesystem.getFile(photoPath,photoName); \r\n f.write(photoToSave); \r\n} \r\n\r\n{noformat}\r\n\r\n\r\nThe above code saves the image in internal phone storage even when sdcard is present on the phone. \r\n\r\nTested with HTC Sensation 4G, Motorola Atrix (2.3.3 Android OS)\r\n\r\n*NOTE: Running the above code in 1.8.2 SDK saves it in the correct location (external storage)*\r\n", "attachment": [], "flagged": false, "summary": "Android: Saved Camera images are not getting stored on sdcard but the internal storage", "creator": { "name": "vjoshi", "key": "vjoshi", "displayName": "Varun Joshi", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "vjoshi", "key": "vjoshi", "displayName": "Varun Joshi", "active": true, "timeZone": "America/New_York" }, "environment": "Platform OS: Android ver 2.3.3\r\nTitnaium SDK: 2.0.2.GA", "comment": { "comments": [ { "id": "198818", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "Was unable to reproduce the fail case against master on Droid 2 2.3.4. Verified that images are saved to sdcard.", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2012-06-16T00:07:28.000+0000", "updated": "2012-06-16T00:07:28.000+0000" }, { "id": "416496", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as I am unable to reproduce the issue using the following environment; \r\nPixel (7.1) \r\nMacOS 10.11.6 (15G31) \r\nStudio 4.8.1.201612050850 \r\nTi SDK 6.0.3 GA \r\nAppc NPM 4.2.8 \r\nAppc CLI 6.1.0 \r\nTi CLI 5.0.11 \r\nAlloy 1.9.5 \r\nArrow 1.10.1 \r\nXcode 8.2 (8C38) \r\nNode v4.6.0 \r\nJava 1.7.0_80", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-31T17:17:43.000+0000", "updated": "2017-03-31T17:17:43.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }