+ (CGSize)df_scaleImage:(UIImage *) image withLength:(CGFloat) imageLength
{
CGFloat newWidth = 0.0f;
CGFloat newHeight = 0.0f;
CGFloat width = image.size.width;
CGFloat height = image.size.height;
if (width > imageLength || height > imageLength){
if (width > height) {
newWidth = imageLength;
newHeight = newWidth * height / width;
}else if(height > width){
newHeight = imageLength;
newWidth = newHeight * width / height;
}else{
newWidth = imageLength;
newHeight = imageLength;
}
}else{
return CGSizeMake(width, height);
}
return CGSizeMake(newWidth, newHeight);
}