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)

     {

 

     }];

相关文章:

  • 2021-11-15
  • 2022-12-23
  • 2022-12-23
  • 2021-06-01
  • 2021-05-16
  • 2022-12-23
  • 2021-12-10
  • 2021-10-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-11
  • 2022-12-23
  • 2022-12-23
  • 2022-01-21
  • 2021-05-27
相关资源
相似解决方案