UIImage* resizedImage(UIImage *inImage, CGRect thumbRect)
{
UIGraphicsBeginImageContext(thumbRect.size);
// Draw into the context, this scales the image
[inImage drawInRect:CGRectMake(0, 0, thumbRect.size.width, thumbRect.size.height)];
UIImage* result = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return result;
}