{ "id": "63327", "key": "TIMOB-2695", "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": "11233", "name": "Release 1.6.0", "archived": true, "released": true, "releaseDate": "2011-02-23" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:59:50.000+0000", "created": "2011-04-15T03:27:15.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "crop", "imageview", "ios", "release-1.6.0" ], "versions": [], "issuelinks": [], "assignee": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:59:50.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": "{html}

Feature request for cropping of images.
\nSeveral HD tickets are asking for this, most recent one being this\none http://developer.appcelerator.com/helpdesk/view/62781

{html}", "attachment": [], "flagged": false, "summary": "iOS crop property to image views.", "creator": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "129214", "author": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [8924a7783bf5dc7e7d5c3e478ce437b8f23eb199])\n[#2695 state:in-progress] Implemented as a blob's\nimageAsCropped method. Takes one argument with width, height, x,\nand y properties. Test needs to be created before sending to fixed.\n\nhttps://github.com/appcelerator/titanium_mobile/commit/8924a7783bf5...

{html}", "updateAuthor": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:27:15.000+0000", "updated": "2011-04-15T03:27:15.000+0000" }, { "id": "129215", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

Tested on 1.6 with the following code and it works as\nexpected:

\n
\n
\n
\n\n\n
\n
\n
\nvar cropImage = function(imageView,width,height,x,y){\n    // with the var 'a' we avoid the image to triger the 'load' listener infinite times\n    var a = 1;\n    imageView.addEventListener('load',function(){\n        if(a==1){\n            imageView.image = imageView.toBlob().imageAsCropped({width:width,height:height,x:x,y:y});\n        }\n        a++;\n    });\n};\n// example:\nvar win = Ti.UI.createWindow();\nwin.backgroundColor=backgroundColor='#ccc';\nvar imageWidth=180;\nvar imageHeight=100;\nvar imageX=200;\nvar imageY=10;\nvar photo = Ti.UI.createImageView({\n    image:'http://www.google.com/images/logos/ps_logo2.png',\n    top:50,\n    left:120,\n    width:imageWidth,\n    height:imageHeight\n});\ncropImage(photo,imageWidth,imageHeight,imageX,imageY);\nwin.add(photo);\nwin.open();\n
\n
\n\n\n
\n\n
\niPhone Simulator 4.2
{html}", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:27:15.000+0000", "updated": "2011-04-15T03:27:15.000+0000" }, { "id": "129216", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Resolving ticket as per the above.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:27:16.000+0000", "updated": "2011-04-15T03:27:16.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }