Created
January 16, 2012 18:32
-
-
Save jonalter/1622212 to your computer and use it in GitHub Desktop.
Resize image in imageView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function squareImage(imageView){ | |
function getThumb(){ | |
imageView.removeEventListener('load',getThumb); | |
var blob = imageView.toBlob(); | |
var height = blob.height; | |
var width = blob.width; | |
if(height < width){ | |
var size = height; | |
}else{ | |
var size = width; | |
} | |
// Ti.API.info('h '+height+' w '+width); | |
// imageView.image = blob.imageAsThumbnail(size,0,radius); | |
imageView.image = imageView.toBlob().imageAsCropped({width:size,height:size}); | |
} | |
imageView.addEventListener('load',getThumb); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I like it!