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)

         {

     

         }];

  • 相关阅读:
    BZOJ-1034-[ZJOI2008]泡泡堂BNB(贪心)
    BZOJ-2456-mode(思维题)
    POJ-2528-Mayor's posters(线段树+离散化)
    POJ-2352-Stars(树状数组)
    HDU-2688-Rotate(树状数组)
    POJ-1195-Mobile phones(二维树状数组)
    YYHS-NOIP2017Training0921-逆光
    YYHS-鏖战字符串(斜率优化)
    左偏树
    2-sat模板
  • 原文地址:https://www.cnblogs.com/uwking/p/4218362.html
Copyright © 2011-2022 走看看