UIImage *img = [self thumbnailWithImage:[UIImage imageWithContentsOfFile:filePath] size:CGSizeMake(120, 120)];
+ (UIImage *)thumbnailWithImage:(UIImage *)image size:(CGSize)asize
{
UIImage *newimage;
if (nil == image) {
newimage = nil;
}
else{
UIGraphicsBeginImageContext(asize);
[image drawInRect:CGRectMake(0, 0, asize.width, asize.height)];
newimage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
return newimage;
}