Skip to content

Instantly share code, notes, and snippets.

@jonalter
Created January 16, 2012 18:32
Show Gist options
  • Save jonalter/1622212 to your computer and use it in GitHub Desktop.
Save jonalter/1622212 to your computer and use it in GitHub Desktop.
Resize image in imageView
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);
};
@pec1985
Copy link

pec1985 commented Feb 3, 2012

I like it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment