{ "id": "173681", "key": "TIMOB-27108", "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": "20832", "name": "Release 8.3.0", "archived": false, "released": true, "releaseDate": "2019-11-25" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2019-09-30T14:21:54.000+0000", "created": "2019-05-28T22:30:59.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "HTTPClient", "android", "blob", "engSchedule", "mimetype" ], "versions": [], "issuelinks": [], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2019-09-30T14:21: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": "10202", "name": "Android", "description": "Android Platform" } ], "attachment": [ { "id": "66701", "filename": "NasaMars.png", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-06-15T00:33:39.000+0000", "size": 811946, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: HTTPClient \"responseData\" blob returns 0 width/height for images over 512kb", "creator": { "name": "rdperottoni", "key": "rdperottoni", "displayName": "Rodolfo Perottoni", "active": true, "timeZone": "Australia/Brisbane" }, "subtasks": [], "reporter": { "name": "rdperottoni", "key": "rdperottoni", "displayName": "Rodolfo Perottoni", "active": true, "timeZone": "Australia/Brisbane" }, "environment": "SDK 8.1.0.v20190510141905\r\nSeen on Android 7", "comment": { "comments": [ { "id": "448878", "author": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~topener], were you able to repro this issue using the test case above? I was not able to repro it. This is my environment:\r\n\r\nAndroid 7.0 (Device) and 7.1.1 (Emulator)\r\nMacOS 10.14.5\r\nStudio 5.1.2.201903111843\r\nTi SDK 8.1.0.v20190524093319\r\nAppc NPM 4.2.3\r\nAppc CLI 7.0.12-4\r\nTi CLI 5.1.1\r\nNode 8.11.4\r\nJava 1.8.0_131\r\nti.imagefactory 4.0.0\r\n\r\nIt prints the correct image size both times when I launch the app.\r\n\r\nEDIT: [~topener] Can you get the URL the user is using for the image? If he is using an image with an unrecognized extension (ie not jpg, png, etc) he might get this issue.", "updateAuthor": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-06-05T22:35:29.000+0000", "updated": "2019-06-10T04:11:26.000+0000" }, { "id": "448949", "author": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~rdperottoni] thanks for creating this ticket. I just made my last comment viewable. Can you please provide more information about your environment/settings? I was not able to reproduce it. Does it return the image sizes with SDK 8.0.0/8.0.1?", "updateAuthor": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-06-10T04:14:01.000+0000", "updated": "2019-06-10T04:14:01.000+0000" }, { "id": "448960", "author": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I was able to reproduce it with the environment I listed in my previous comment. The size is returned correctly when the image extension is png or jpg. When the image extension is .jpeg, it shows 0,0 for the first console.log statement in the test case. The link to the external image I used was:\r\nhttps://upload.wikimedia.org/wikipedia/en/f/f6/Sample_0.JPEG\r\n", "updateAuthor": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-06-10T18:28:48.000+0000", "updated": "2019-06-10T18:28:48.000+0000" }, { "id": "449101", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "It turns out that this issue has nothing to do with the file extension.\r\n\r\nThis issue only happens when downloading an image file is over 512 KB, which is Titanium's max buffer size. This can be reproduced by the \"NasaMars.png\" image attached to this ticket. A file that exceeds this size will downloaded to a temp file instead of in-memory instead. The reason this bug happens is because Titanium wraps this temp file via a \"responseData\" blob as it downloads, but will fail to fetch the image width/height initially since the image's header bytes have not been fully downloaded yet. The fix on our end is to re-read the image file's header once the download completes.\r\n\r\nNote that the max buffer size used by {{HTTPClient}} can be changed via the \"tiapp.xml\" property \"ti.android.httpclient.maxbuffersize\", but I don't recommend changing it.\r\nhttps://docs.appcelerator.com/platform/latest/#!/guide/tiapp.xml_and_timodule.xml_Reference\r\n\r\nA simple work-around is to do the following instead. This takes the existing temp file blob (if written to file) and creates a new blob for it when you call the {{read()}} method. Note that this does not read all of the bytes in the file. It simply wraps the file reference, making this work-around the better solution from a performance standpoint.\r\n{code:javascript}\r\nvar imageBlob = httpClient.responseData;\r\nif (imageBlob.file) {\r\n\timageBlob = imageBlob.file.read();\r\n}\r\nTi.API.info(\"@@@ onload() imageBlobSize: \" + imageBlob.width + \"x\" + imageBlob.height);\r\n{code}\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-06-15T00:52:32.000+0000", "updated": "2019-06-15T00:52:32.000+0000" }, { "id": "449102", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/10964", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-06-15T01:36:43.000+0000", "updated": "2019-06-15T01:36:43.000+0000" }, { "id": "451227", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "merged to master. No need for \"backport\" as 8_3_X is going away", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2019-09-09T18:43:34.000+0000", "updated": "2019-09-09T18:43:34.000+0000" }, { "id": "451703", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket, fix verified in SDK version {{8.3.0.v20190927113609}}.\r\n\r\nTest and other information can be found at: \r\nhttps://github.com/appcelerator/titanium_mobile/pull/10964", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-09-30T14:21:45.000+0000", "updated": "2019-09-30T14:21:45.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }