{ "id": "122421", "key": "TIMOB-15707", "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": "15935", "description": "2014 Sprint 06", "name": "2014 Sprint 06", "archived": true, "released": true, "releaseDate": "2014-03-28" }, { "id": "15936", "description": "2014 Sprint 06 SDK", "name": "2014 Sprint 06 SDK", "archived": true, "released": true, "releaseDate": "2014-03-28" }, { "id": "15971", "description": "Release 3.2.3", "name": "Release 3.2.3", "archived": false, "released": true, "releaseDate": "2014-04-30" }, { "id": "15422", "description": "Release 3.3.0", "name": "Release 3.3.0", "archived": false, "released": true, "releaseDate": "2014-07-16" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-03-17T21:08:34.000+0000", "created": "2013-11-13T19:09:48.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "imageView", "parity", "qe-closed-3.2.3", "qe-testadded", "supportTeam" ], "versions": [ { "id": "15593", "description": "Release 3.1.3", "name": "Release 3.1.3", "archived": true, "released": true, "releaseDate": "2013-09-18" }, { "id": "15856", "description": "Release 3.2.1", "name": "Release 3.2.1", "archived": false, "released": true, "releaseDate": "2014-02-10" } ], "issuelinks": [ { "id": "45135", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "inwardIssue": { "id": "99640", "key": "TIMOB-10735", "fields": { "summary": "iOS: ImageView with height or width of Ti.UI.SIZE sizes improperly", "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": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2015-01-27T21:27:46.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": "h6.Issue description\r\nIf you create an imageView of a predetermined height but do not specify the width, an image of unknown dimensions is scaled correctly to fit. \r\n\r\nIf we know the exact dimensions of the image we can specify both the width and height of the image view to be proportional and the left indent is respected. However there is some misbehaviour that occurs with PNG format images that are remote. They aren't left aligned correctly in iOS. Android position this remote PNG image correctly. Screen shoot attached: ImageView_Remote_iOS_PNG_format.jpg\r\n\r\nh6.Test Case\r\n{code}\r\nvar imgUrlpng = 'http://www.elpuercoespin.com.ar/images/2013/01/fifa_logo.png';\r\nvar imgUrljpg = 'http://imagenes.es.sftcdn.net/es/scrn/75000/75908/fifa-manager-09-40.jpg';\r\n\r\nvar win = Ti.UI.createWindow({backgroundColor: 'white'});\r\nvar myImage = Ti.UI.createImageView({\r\n left: 10,\r\n width: Ti.UI.SIZE,\r\n height: 200, \r\n //local\r\n //image.jpg & KS_nav_views.png attached to jira \r\n //image: 'image.jpg', /* iOS -> remote or local respected */\r\n //image: 'KS_nav_views.png'\r\n\r\n //remote\r\n //left property not respected (format PNG) - iOS\r\n //left property respected (format PNG) - Android\r\n image: imgUrlpng \r\n\r\n //image: imgUrljpg //left property respected\r\n});\r\n\r\n// this would work:\r\n//myImage.image = 'http://example.com/foo.png'\r\n// set myImage.defaultImage = 'localFoo.png' to show an image while the remote one is loading\r\nmyImage.defaultImage = 'KS_nav_views.png'; // to show an image while the remote one is loading\r\n\r\n// as would\r\n//myImage.image = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory,'foo.png');\r\n\r\nwin.add(myImage);\r\nwin.open();\r\n{code}\r\n\r\nh6.Work around\r\nTo ensure an incoming image is scaled to 23 pixels in height and is left justified by 10 pixels (both platforms), without knowing the incoming image dimensions:\r\n{code}\r\nvar imgUrlpng = 'http://www.elpuercoespin.com.ar/images/2013/01/fifa_logo.png';\r\nvar imgUrljpg = 'http://imagenes.es.sftcdn.net/es/scrn/75000/75908/fifa-manager-09-40.jpg';\r\n\r\nvar win = Ti.UI.createWindow({backgroundColor: 'white'});\r\n\r\nvar imageTemp = Ti.UI.createImageView({\r\n image: imgUrlpng,\r\n height: Ti.UI.SIZE,\r\n width: Ti.UI.SIZE\r\n });\r\n\r\nvar imgWidth = imageTemp.toImage().width; \r\nvar imgHeight = imageTemp.toImage().height;\r\n\r\nvar relativeWidth = 23/imgHeight * imgWidth;\r\n\r\nvar tiHeaderImage = Ti.UI.createImageView({\r\n image: imgUrlpng,\r\n height: 23,\r\n width: relativeWidth,\r\n left: 10,\r\n preventDefaultImage: true\r\n});\r\n\r\nwin.add(tiHeaderImage);\r\n\r\nwin.open();\r\n{code}", "attachment": [ { "id": "43888", "filename": "image.jpg", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-11-13T19:09:48.000+0000", "size": 600, "mimeType": "image/jpeg" }, { "id": "43882", "filename": "ImageView_Remote_Android-2.3.5_JPG_format.png", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-11-13T19:09:48.000+0000", "size": 21863, "mimeType": "image/png" }, { "id": "43883", "filename": "ImageView_Remote_Android-2.3.5_PNG_format.png", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-11-13T19:09:48.000+0000", "size": 69708, "mimeType": "image/png" }, { "id": "43884", "filename": "ImageView_Remote_Android-4.0.4_JPG_format.png", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-11-13T19:09:48.000+0000", "size": 21027, "mimeType": "image/png" }, { "id": "43885", "filename": "ImageView_Remote_Android-4.0.4_PNG_format.jpg.png", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-11-13T19:09:48.000+0000", "size": 72305, "mimeType": "image/png" }, { "id": "43886", "filename": "ImageView_Remote_iOS_JPG_format.jpg", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-11-13T19:09:48.000+0000", "size": 65441, "mimeType": "image/jpeg" }, { "id": "43887", "filename": "ImageView_Remote_iOS_PNG_format.jpg", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-11-13T19:09:48.000+0000", "size": 106535, "mimeType": "image/jpeg" }, { "id": "43889", "filename": "KS_nav_views.png", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-11-13T19:09:48.000+0000", "size": 1074, "mimeType": "image/png" } ], "flagged": false, "summary": "iOS: Left alignment for scaled images", "creator": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "environment": "TiSDK 3.1.3.GA, 3.2.1.GA\r\niOS 7\r\nAndroid 2.3.x to 4.0.x", "comment": { "comments": [ { "id": "297410", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "This has nothing to do with JPG and PNG images.\n\nAndroid scales images automatically to match device density based on image density.\n\niOS does no such thing. We treat image dimensions as density independent. That is native platform behavior.\n\nThe problem is that when calculating width for SIZE behavior iOS does not consider height parameter. We will fix this for ImageView if the height is specified as a fixed height (Anything other than auto, SIZE, FILL or PERCENT)", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-03-15T18:30:20.000+0000", "updated": "2014-03-15T18:30:20.000+0000" }, { "id": "297411", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Test Case\n{code}\nvar win = Ti.UI.createWindow({\n backgroundColor:'#fff',\n layout:'vertical'\n});\n \nvar image = Ti.UI.createImageView({ \n image: \"http://www.catravelservices.com/management/hotels/pictures/Mawamba_lodge_nature.jpg\", \n backgroundColor : \"red\" \n});\n \n \nvar label = Ti.UI.createLabel({\n text:'Results Here'\n})\n \nvar updateLabel = function(){\n var size = image.size;\n label.text = 'ImageView size is '+size.width+'x'+size.height;\n}\n \nvar controlsContainer = Ti.UI.createView({\n height:Ti.UI.SIZE\n})\n \nvar widthControls = Ti.UI.createView({\n width:'50%',\n layout:'vertical',\n left:0,\n height:Ti.UI.SIZE\n})\n \nvar heightControls = Ti.UI.createView({\n width:'50%',\n layout:'vertical',\n right:0,\n height:Ti.UI.SIZE\n})\n \ncontrolsContainer.add(widthControls);\ncontrolsContainer.add(heightControls);\n \nvar b1 = Ti.UI.createButton({title:'WIDTH=SIZE'})\nvar b2 = Ti.UI.createButton({title:'WIDTH=165'})\nvar b3 = Ti.UI.createButton({title:'WIDTH=250'})\nvar b4 = Ti.UI.createButton({title:'HEIGHT=SIZE'})\nvar b5 = Ti.UI.createButton({title:'HEIGHT=50'})\nvar b6 = Ti.UI.createButton({title:'HEIGHT=165'})\nb1.addEventListener('click',function(e){\n image.width=Ti.UI.SIZE;\n setTimeout(updateLabel,500);\n})\nb2.addEventListener('click',function(e){\n image.width=165;\n setTimeout(updateLabel,500);\n})\nb3.addEventListener('click',function(e){\n image.width=250;\n setTimeout(updateLabel,500);\n})\nb4.addEventListener('click',function(e){\n image.height=Ti.UI.SIZE;\n setTimeout(updateLabel,500);\n})\nb5.addEventListener('click',function(e){\n image.height=50;\n setTimeout(updateLabel,500);\n})\nb6.addEventListener('click',function(e){\n image.height=165;\n setTimeout(updateLabel,500);\n})\nwin.add(image);\nwidthControls.add(b1);\nwidthControls.add(b2);\nwidthControls.add(b3);\nheightControls.add(b4);\nheightControls.add(b5);\nheightControls.add(b6);\nwin.add(controlsContainer);\nwin.add(label)\nwin.open();\n{code}", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-03-15T18:31:34.000+0000", "updated": "2014-03-15T18:31:34.000+0000" }, { "id": "297412", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Pull pending\r\nmaster - https://github.com/appcelerator/titanium_mobile/pull/5478\r\n3_2_X - https://github.com/appcelerator/titanium_mobile/pull/5479", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-03-15T18:36:37.000+0000", "updated": "2014-03-15T18:36:37.000+0000" }, { "id": "297766", "author": { "name": "oromero", "key": "oromero", "displayName": "Olga Romero", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested and verified the fix with:\nAppcelerator Studio, build: 3.2.3.201403171239\nTitanium SDK, build: 3.2.3.v20140317142455\nNode.JS Version: v0.10.13\nNPM Version: 1.3.2\n├── acs@1.0.14\n├── alloy@1.3.1\n├── npm@1.3.2\n├── titanium@3.2.1\n└── titanium-code-processor@1.1.0\nDevice:iPhone5S iOS 7.0.1\nImage aligned correctly in iOS\n", "updateAuthor": { "name": "oromero", "key": "oromero", "displayName": "Olga Romero", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-03-18T21:28:31.000+0000", "updated": "2014-03-18T21:28:31.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }