Iphone retrieves image using url using ALAsset

I want to know how to get image using url. I am using ALAsset. I followed the answer (the one with the mark) from the following link to display the image from the URL received from ALAsset on the iPhone . How to get an image and upload it?

+6
upload iphone image alasset
source share
3 answers

Did you manage to get ALAsset? Once you do, getting an image is easy. To get a sketch, the asset has a method ... thumbnail.

UIImage *img = [UIImage imageWithCGImage:[myAsset thumbnail]];

To get the full Res image, you need to go through the default view.

UIImage *img = [UIImage imageWithCGImage:[[myAsset defaultRepresentation] fullResolutionImage]

Hope this helps

+16
source share

I know this is an old question, but just in case someone else came along, I found another method (iOS 5+ is required) that returns easier work with the image:

 UIImage *img = [UIImage imageWithCGImage:[[myAsset defaultRepresentation] fullScreenImage]; 


From fullScreenImage docs:

In iOS 5 and later, this method returns a fully cropped, rotated, and adjusted image — just like the user sees in the Photo or image picker.

monkybonk05 the answer works, but does not crop and does not rotate.

+3
source share

Check this method

 + (UIImage *)imageFromAsset:(ALAsset *)asset { ALAssetRepresentation *representation = [asset defaultRepresentation]; return [UIImage imageWithCGImage:representation.fullResolutionImage scale:[representation scale] orientation:(UIImageOrientation)[representation orientation]]; } 

I adjusted it a bit based on this principle: https://gist.github.com/NR4TR/8576048

+2
source share

All Articles