{ "id": "92374", "key": "TIMOB-9270", "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": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" }, { "id": "13404", "description": "Sprint 2012-12 Core", "name": "Sprint 2012-12 Core", "archived": true, "released": true, "releaseDate": "2012-06-17" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-06-08T14:50:26.000+0000", "created": "2012-05-24T19:21:44.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "SupportTeam", "core", "qeport" ], "versions": [ { "id": "13272", "description": "Release 2.0.1", "name": "Release 2.0.1", "archived": true, "released": true, "releaseDate": "2012-04-16" } ], "issuelinks": [], "assignee": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-06-15T14:51: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": "h3. Problem\r\n\r\nCannot get the size (height and width) of the image in the imageview after it has finished loading from a remote location. \r\n\r\nh4. Sample Code\r\n\r\nPlease run the code below to reproduce the issue\r\n\r\n{noformat}\r\n\r\n//create component instance\r\nvar self = Ti.UI.createWindow({\r\n backgroundColor : '#ffffff',\r\n navBarHidden : true,\r\n exitOnClose : true\r\n});\r\n\r\n//construct UI\r\nvar boundingBox = Ti.UI.createView({\r\n backgroundColor : 'red',\r\n width : Ti.UI.SIZE,\r\n height : Ti.UI.SIZE\r\n});\r\n\r\nvar sampleImageFromFarAway = Ti.UI.createImageView({\r\n image : 'https://www.google.com/images/logo_sm.gif',\r\n height : Ti.UI.SIZE, //'auto',\r\n width : Ti.UI.SIZE, //'auto',\r\n preventDefaultImage : true,\r\n borderAroundMeView : boundingBox\r\n});\r\n\r\nvar lateImageLoadingHandler = function(e) {\r\n Ti.API.info('1 Height: ' + sampleImageFromFarAway.size.height + ' Width: ' + sampleImageFromFarAway.size.width);\r\n \r\n var blob = sampleImageFromFarAway.toImage();\r\n\r\n Ti.API.info('Height after toImage: ' + blob.height + ' Width after toImage: ' + blob.width);\r\n var borderView = sampleImageFromFarAway.borderAroundMeView;\r\n borderView.width = blob.width + 24;\r\n borderView.height = blob.height + 24;\r\n\r\n}\r\n\r\nsampleImageFromFarAway.addEventListener('load', lateImageLoadingHandler);\r\n\r\nboundingBox.add(sampleImageFromFarAway);\r\nself.add(boundingBox);\r\n\r\nself.open(); \r\n\r\n{noformat}\r\n\r\nAlso tried converting the image to toImage() as seen above but still could not get the correct height and width of the image.\r\n\r\nh3. Actual Output\r\n\r\nPlease see the screenshot attached. The height and width are returned as 0 and after doing a toImage() are returned as a random \"100\"\r\n\r\nAlso attached is the output of the same code in iOS. ", "attachment": [ { "id": "27938", "filename": "ScreenShot-Android.png", "author": { "name": "vjoshi", "key": "vjoshi", "displayName": "Varun Joshi", "active": true, "timeZone": "America/New_York" }, "created": "2012-05-24T19:21:44.000+0000", "size": 171944, "mimeType": "image/png" }, { "id": "27939", "filename": "ScreenShot-iOS.png", "author": { "name": "vjoshi", "key": "vjoshi", "displayName": "Varun Joshi", "active": true, "timeZone": "America/New_York" }, "created": "2012-05-24T19:21:44.000+0000", "size": 141868, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: Cannot get size of the remote image in imageview after load completes", "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", "comment": { "comments": [ { "id": "197913", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Sample image is 150 x 55", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-06-08T14:11:49.000+0000", "updated": "2012-06-08T14:11:49.000+0000" }, { "id": "197920", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Fixed in 2.1.0.7d81569.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-06-08T14:50:26.000+0000", "updated": "2012-06-08T14:50:26.000+0000" }, { "id": "198771", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with 2.1.0.v20120615104152 with Droid 3 2.3.4", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-06-15T14:51:08.000+0000", "updated": "2012-06-15T14:51:08.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }