{ "id": "97720", "key": "TIMOB-10061", "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": "2012-07-23T10:29:37.000+0000", "created": "2012-07-20T11:23:15.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "core" ], "versions": [ { "id": "13273", "description": "Release 2.0.2", "name": "Release 2.0.2", "archived": false, "released": true, "releaseDate": "2012-05-31" }, { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" } ], "issuelinks": [], "assignee": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-09T23:12:54.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "h3. Problem\r\n\r\nWhen we use Ti.Utils.base64encode() to encode an image blob and then use Ti.Utils.base64decode(), the height and width of the blob are 0. Prior to base 64 encoding the blob, we are able to get the correct height and width properties from the blob.\r\n\r\nh3. Test case\r\n\r\n{code}\r\n\r\n\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : 'pink'\r\n});\r\n\r\nwin.open();\r\n\r\nvar img = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'test.png');\r\n\r\nvar str_blob = img.read();\r\nalert(str_blob.width);\r\nalert(str_blob.height);\r\n\r\nvar str_64 = Ti.Utils.base64encode(str_blob);\r\nvar decoded = Ti.Utils.base64decode(str_64);\r\n\r\nalert('Height: ' + decoded.height + 'Width: ' + decoded.width);\r\n\r\n{code}\r\n\r\nh3. Expected behavior\r\n\r\nThe height and width properties should be available.", "attachment": [], "flagged": false, "summary": "iOS: If we base64 encode and then decode an image blob, the blob loses the height and width property", "creator": { "name": "btran", "key": "btran", "displayName": "Betty Tran", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "btran", "key": "btran", "displayName": "Betty Tran", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "iOS 5\r\nTitanium SDK 2.1.0GA and 2.0.2GA", "comment": { "comments": [ { "id": "208889", "author": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "body": "base64decode returns a raw data(blob), no mime-type information available.", "updateAuthor": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-23T10:29:37.000+0000", "updated": "2012-07-23T10:29:37.000+0000" }, { "id": "208923", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Occurs because when you base64-encode an image, what you're storing is the image's ORIGINAL size along with the blob, which is what is available. It would be possible to store a modified image as the blob, but that may not always be desired behavior for a number of reasons.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-23T12:16:18.000+0000", "updated": "2012-07-23T12:16:18.000+0000" }, { "id": "208935", "author": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Pedro,\r\nencode/decode !== serialize/deserialize\r\n\r\nTechnically, what you need to do prior to reading width/height properties is decoded.mimeType = str_blob.mimeType, but we have no setter for mimeType in the platform.\r\nFor the File.read, we get mimeType from file name, but it's not stored during encode/decode.\r\n\r\n", "updateAuthor": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-23T13:17:45.000+0000", "updated": "2012-07-23T13:17:45.000+0000" }, { "id": "410943", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-09T23:12:54.000+0000", "updated": "2017-03-09T23:12:54.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }