zoukankan      html  css  js  c++  java
  • ios 判断相册文件图片大小的方法

    ALAssetsLibrary* alLibrary = [[ALAssetsLibrary alloc] init];

        

        [alLibrary assetForURL:[info objectForKey:UIImagePickerControllerReferenceURL] resultBlock:^(ALAsset *asset)

         {

             ALAssetRepresentation *representation = [asset defaultRepresentation];

             if ([representation size] > 1000*1000*2)

             {

                 UIAlertView *alert = [[UIAlertView alloc]initWithTitle:nil message:@"图片超出了2M,请重新选择" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];

                 alert.tag = KIMAGE_EXCEED_TAG;

                 [alert show];

                 return;

             }

             else

             {

                 UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];

                 UIImage *uploadImage = [FMUImage imageByScalingAndCroppingForSize:CGSizeMake(800, 600) SourceImage:image CropType:FMUIMAGE_SCALE_TYPE_FITMIN];

                 //发起上传网络请求

                 self.temper = [gNetworkManager uploadHousePic:uploadImage delegate:self]

                 

                [self dismissModalViewControllerAnimated:YES];

                 

             }

         }

                  failureBlock:^(NSError *error)

         {

     

         }];

  • 相关阅读:
    网页返回码大全
    求数组中子数组的最大和
    什么是面向对象?面向对象与面向过程的区别?
    Java内部类
    Java拆箱装箱
    linux中su和sudo区别
    Linux 中账户管理
    解决warn appiumdoctor bin directory for $java_home is not set
    Moco之include
    Mock server 之 Moco的使用
  • 原文地址:https://www.cnblogs.com/uwking/p/4218362.html
Copyright © 2011-2022 走看看