{ "id": "171049", "key": "TIMOB-25758", "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": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2018-02-07T08:46:32.000+0000", "created": "2018-02-07T07:26:43.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-02-07T08:46:32.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.Reproduce\r\n1.Add following simple code to classic app.\r\n2.Run the app on iOS device.\r\n3.Click button to pick one of your image, then display it. You will see the image is cut in the bottom.\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor:\"white\"\r\n});\r\n\r\nvar button = Ti.UI.createButton({\r\n title : 'Open Gallery',\r\n width : 100,\r\n height : 50,\r\n top : 20\r\n});\r\n\r\nvar imageView = Ti.UI.createImageView({\r\n top : 100\r\n});\r\n\r\nbutton.addEventListener('click', function(){\r\n Ti.Media.openPhotoGallery({\r\n success: function(event) {\r\n Ti.API.debug(event.mediaType);\r\n if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {\r\n \r\n var obj = calculateAspectRatioFit(event.media.width, event.media.height, 700, 700);\r\n var resizedBlob = event.media.imageAsResized(obj.width, obj.height);\r\n resizedBlob.imageAsCompressed(0.7);\r\n\r\n imageView.image = resizedBlob;\r\n win.add(imageView);\r\n }\r\n },\r\n cancel: function() {},\r\n error: function(e) {\r\n Ti.API.error(e.code);\r\n },\r\n });\r\n});\r\n\r\nwin.add(button);\r\nwin.open()\r\n\r\nfunction calculateAspectRatioFit(srcWidth, srcHeight, maxWidth, maxHeight) {\r\n var ratio = Math.min(maxWidth / srcWidth, maxHeight / srcHeight);\r\n\r\n return {\r\n width : srcWidth * ratio,\r\n height : srcHeight * ratio\r\n };\r\n}\r\n{code}\r\n\r\nh6.Note.\r\nSeems only happened to iOS.", "attachment": [ { "id": "64814", "filename": "01517988429_original.png", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2018-02-07T08:08:10.000+0000", "size": 1146976, "mimeType": "image/png" }, { "id": "64813", "filename": "IMG_4269.png", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2018-02-07T08:07:57.000+0000", "size": 1180818, "mimeType": "image/png" } ], "flagged": false, "summary": "iOS: Image will be cut in the bottom after apply imageAsCompressed and imageAsSized", "creator": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "subtasks": [], "reporter": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "environment": "iOS 11.2.2\r\niPhone 5\r\nSDK 7.0.1.GA", "comment": { "comments": [ { "id": "434151", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "body": "Duplicate to TIMOB-25336", "updateAuthor": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2018-02-07T08:46:32.000+0000", "updated": "2018-02-07T08:46:32.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }