{ "id": "135486", "key": "TIMOB-17567", "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": [ { "id": "16593", "description": "Release 4.0.0", "name": "Release 4.0.0", "archived": false, "released": true, "releaseDate": "2015-05-21" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-11-22T00:51:28.000+0000", "created": "2014-08-27T22:14:08.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "exalture", "parity", "supportTeam" ], "versions": [ { "id": "15857", "description": "Release 3.2.2", "name": "Release 3.2.2", "archived": false, "released": true, "releaseDate": "2014-03-09" } ], "issuelinks": [ { "id": "40374", "type": { "id": "10001", "name": "Cloners", "inward": "is cloned into", "outward": "is cloned from" }, "outwardIssue": { "id": "129699", "key": "TIMOB-16882", "fields": { "summary": "iOS: Converting a blob into a valid image does not maintain dimensions", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "updated": "2015-02-11T21:35:08.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": "h6.Issue description\r\nLooking for a cross-platform way to create image thumbnail files asynchronously. Titanium is able to read an image file asynchronously into a buffer and then a blob. If we assign that blob to the image property of an ImageView, it displays as I expect. However, the blob is not recognised as an image by any of the Ti.Blob.image* methods. The blob has a mime type of \"application/octet-stream\" and a height and width of 0. Meanwhile Android is able to get height and width properly.\r\n\r\nh6.Steps to reproduce\r\n# Launch sample app. You can see that the fishImage ImageView loads its image directly from a file path in its \"image\" property.\r\n# earthImage is loaded in index.js asynchronously using a file stream. Once the file contents are read completely, they are assigned to the image property of $.earthImage. \r\n# Notice, the blob you get as a result of \"earthBuffer.toBlob()\" can't be used for any other image manipulation (e.g. creating thumbnails). It doesn't have a valid height, or width on Android. \r\n\r\nE.G.\r\n{code}\r\n$.earthImage.image = earthBuffer.toBlob();\r\nTi.API.info( $.earthImage.image.height + ' . '+ $.earthImage.image.width + ' . '+ $.earthImage.image.mimeType);\r\n{code}\r\n\r\nh6.Android\r\n{code}\r\n04-24 15:11:03.812: I/TiAPI(28395): 0 . 0 . application/octet-stream\r\n{code}\r\n\r\nh6.iOS\r\n{code}\r\n[INFO] 1600 . 2560 . application/octet-stream\r\n[INFO] 1600 . 2560 . application/octet-stream\r\n{code}", "attachment": [ { "id": "50857", "filename": "MapModule.zip", "author": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-29T06:51:00.000+0000", "size": 5985406, "mimeType": "application/zip" } ], "flagged": false, "summary": "Android: Converting a blob into a valid image does not maintain dimensions", "creator": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "pagarwal", "key": "pagarwal", "displayName": "Priya Agarwal", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "\r\nAPI Levels 11 - 19", "closedSprints": [ { "id": 241, "state": "closed", "name": "2014 Sprint 22 SDK", "startDate": "2014-10-27T22:25:43.407Z", "endDate": "2014-11-08T01:00:00.000Z", "completeDate": "2014-11-10T20:10:00.899Z", "originBoardId": 114 }, { "id": 154, "state": "closed", "name": "2014 Sprint 15 SDK", "startDate": "2014-07-21T21:56:31.515Z", "endDate": "2014-08-02T00:00:00.000Z", "completeDate": "2014-08-04T21:03:51.067Z", "originBoardId": 114 }, { "id": 251, "state": "closed", "name": "2014 Sprint 23 SDK", "startDate": "2014-11-10T22:56:44.608Z", "endDate": "2014-11-22T01:00:00.000Z", "completeDate": "2014-11-22T05:03:36.553Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "320686", "author": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Issue was reproducible with 3.3.0 and 3.4.0", "updateAuthor": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-27T22:18:09.000+0000", "updated": "2014-08-27T22:18:09.000+0000" }, { "id": "320952", "author": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Attached sample is a native IOS project, do we have a JavaScript titanium sample?", "updateAuthor": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-08-29T04:57:32.000+0000", "updated": "2014-08-29T04:57:32.000+0000" }, { "id": "320972", "author": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Tried with the following sample and Android works without any issues (I can see 'width' and 'height' and thumbnail creation also works fine.\r\n{code}\r\n var earthFile,\r\n\tearthFileStream,\r\n\tearthBuffer=null;\r\n\r\n\r\n\tvar w = Ti.UI.createWindow({backgroundColor:'white'});\r\n\t\r\n\t\r\n\tvar earthImage = Titanium.UI.createImageView();\r\n\tw.add(earthImage);\r\n\t\r\n\tfunction fileReader(args) {\r\n\t\tif (args.bytesProcessed === -1) {\r\n\t\t\tTi.API.error('Done');\r\n\t\t\tvar blob = earthBuffer.toBlob();\r\n\t\t\tTi.API.info( \"Width= \" + blob.width + ' Height='+ blob.height + ' mimetype='+ blob.mimeType);\r\n\t\t\tearthImage.image = blob.imageAsThumbnail(30);\r\n\t\t\tearthBuffer.release();\r\n\t\r\n\t\t\tearthImage.animate({\r\n\t\t\t\topacity: 1,\r\n\t\t\t\tduration: 100\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\tTi.API.error(args.bytesProcessed + ' of ' + args.totalBytesProcessed);\r\n\t\t\tif (earthBuffer == null) {\r\n\t\t\t\tearthBuffer = Ti.createBuffer();\r\n\t\t\t}\r\n\t\r\n\t\t\tearthBuffer.append(args.buffer);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction loadEarth() {\r\n\t\tearthImage.image = null;\r\n\t\tearthImage.opacity = 0;\r\n\t\r\n\t\tearthFile = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, \"\", 'KS_nav_ui.png');\r\n\t\tearthFileStream = Ti.Filesystem.openStream(Ti.Filesystem.MODE_READ, earthFile.nativePath);\r\n\t\tearthBuffer = null;\r\n\t\r\n\t\tTi.Stream.pump(earthFileStream, fileReader, 512, true);\r\n\t}\r\n\r\n\tearthImage.addEventListener('singletap', loadEarth);\r\n\t\r\n\tw.open();\r\n\tloadEarth();\r\n{code}", "updateAuthor": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-08-29T06:41:56.000+0000", "updated": "2014-08-29T06:41:56.000+0000" }, { "id": "320976", "author": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "body": "updated with the right sample code. \r\n\r\ntested on Nexus 4 running Android 4.0.4 with SDK 3.3.0.GA and master. \r\n\r\n[~salachi] Do retest with attached sample app.", "updateAuthor": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-29T06:52:02.000+0000", "updated": "2014-08-29T06:53:00.000+0000" }, { "id": "321156", "author": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Tried with the attached sample and I don't see the problem, dimension is returned properly\r\nHere is the Log\r\n08-30 21:52:30.093: I/TiAPI(14539): 1600 . 2560 . application/octet-stream\r\n\r\n08-30 21:52:30.101: I/TiAPI(14539): 1600 . 2560 . application/octet-stream\r\n", "updateAuthor": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-08-30T16:26:15.000+0000", "updated": "2014-08-30T16:26:15.000+0000" }, { "id": "327712", "author": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-10-11T02:28:28.000+0000", "updated": "2014-10-11T02:28:28.000+0000" }, { "id": "327756", "author": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-10-11T13:57:22.000+0000", "updated": "2014-10-11T13:57:22.000+0000" }, { "id": "328039", "author": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Replaced the use of getFileExtensionFromUrl as it is for encoded url and won't work with path with special characters.\r\n\r\nhttps://github.com/appcelerator/titanium_mobile/pull/6216\r\n", "updateAuthor": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-10-14T15:48:29.000+0000", "updated": "2014-10-14T15:48:29.000+0000" }, { "id": "328168", "author": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Test case copied from TC\r\n\r\nvar picture1 = 'picture@2x.png';\r\nvar file1 = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, picture1);\r\nvar blob1 = file1.read();\r\nTi.API.info('blob: ' + JSON.stringify(blob1, null, 2));\r\n \r\nvar picture2 = 'pic@ture.png';\r\nvar file2 = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, picture2);\r\nvar blob2 = file2.read();\r\nTi.API.info('blob: ' + JSON.stringify(blob2, null, 2));\r\n", "updateAuthor": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-10-15T14:00:30.000+0000", "updated": "2014-10-15T14:00:30.000+0000" }, { "id": "331963", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "I tried it with the PR: https://github.com/appcelerator/titanium_mobile/pull/6216 and the MapModule.zip code.\r\nThe log for height and width was as follows:\r\n[INFO] : 0 . 0 . application/octet-stream\r\n\r\nAdding comments for a possible fix in the pull request.\r\n\r\n", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2014-11-13T04:35:36.000+0000", "updated": "2014-11-13T04:36:04.000+0000" }, { "id": "342967", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "Verified fix using:\r\n\r\nMac OSX 10.10.2\r\nAppcelerator Studio, build: 4.0.0.201502051633\r\nTitanium SDK build: 4.0.0.v20150211081857\r\nTitanium CLI, build: 3.6.0-dev\r\nAlloy: 1.5.1\r\nAndroid Build tools 21.1.1\r\nNexus 5 (5.0.1), Galaxy S3 (4.4.2)\r\n\r\nBuilt to both devices, when converting the blob to an image the dimensions are maintained.\r\n\r\nClosing ticket.", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2015-02-11T21:35:00.000+0000", "updated": "2015-02-11T21:35:00.000+0000" } ], "maxResults": 11, "total": 11, "startAt": 0 } } }