Obtain images from the album, call the camera to take pictures, and upload the images to the server.Call the camera to take a photo and go to the image taking page: Intent takeIntent = new Intent (MediaStore. ACTION_IMAGE_CAPTURE); // The following sentence specifies the path of the photo storage after the camera is taken. mSzImageFileName = Long. toString (System. currentTimeMillis () + ". png "; takeInten
=uri.fromfile (fileimg);//extract uri//crop image Intent Intent = new Intent ("Com.android.camera.action.CROP"); Intent.setdataandtype (urifromimg, "image/*"); Intent.putextra ("Crop", "true"); Intent.putextra ("Aspectx", 1);// The ASPECTX is a wide-height ratio, where the square is set (the aspect ratio is 1:1) Intent.putextra ("Aspecty", 1); Intent.putextra ("Outputx", 400); Outputx Outputy is a cropped picture with a wide height of Intent.putextra ("Outputy", 400); Somehow, I can't set it too
When you choose a picture from the system and get to their path, you find that some of the images are Uri.getscheme "file", and some of the images are Uri.getscheme "content". All paths that result in Uri.getpath and cannot get all the pictures are resolved with the following code:public static String GetPath (activity activity, Uri Uri) {l.i ("hui", "path before processing:" + URI); if (null = = URI) {return null;} String path = null; String scheme =
Click the button to save the image above Self.imageview to your local album and specify a method to determine the success of the Save Imagesavedtophotosalbum:didfinishsavingwitherror: ContextInfo:-(Ibaction) Saveimagetoalbum: (ID) Sender {Uiimagewritetosavedphotosalbum (Self.imageView.image, Self, @selector (imagesavedtophotosalbum: Didfinishsavingwitherror:contextinfo:), nil);}Implementing ImageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:
Android obtains all pictures, video thumbnails, and album covers on the SD card.Query Images
First, query the inherent Android database. The image Uri isImages.Media.EXTERNAL_CONTENT_URI.The following is a specific instance query,FileInfoIs a custom data model.
Public ArrayList
QueryAllImage (final Context context) {if (context = null) {// judge the validity of the input parameter return null;} Array
Insert a picture into a system album when this method is called, two identical pictures appear in the albumMediaStore.Images.Media.insertImageA picture is the original picture is a thumbnail image. The representation is as follows: The thumbnail image inserted in the android4.4.4 system and the DCIM folder in the SDcard root directory This, Android5.0 above the model inserted thumbnails in the SDcard root d
There is less information on the current location record on the web, so record the pit. Get album Pictures 1: var iPC = Uiimagepickercontroller () 2: ipc.sourcetype = uiimagepickercontrollersourcetype.savedphotosalbum 3: IPC. Delegate = Self 4: true in 5: Print ("complete") 6: } 1: func imagepickercontroller (Picker:uiimagepickercontro
Get the iOS album picture file size,A lot of people, think of is to take the location of the file picture, and then through the NSData to get the image size, as everyone knows, so that the image size is not accurate.The correct method should be implemented in the agentAlassetslibrary* allibrary = [[alassetslibrary alloc] init]; [Allibrary assetforurl:[info objectforkey:Uiimagepickercontrollerreferenceurl] resultblock:^ ( alasset *asset) {alasse
Android provides an API to get some of the information in a system album, mainly through ContentProvider to get what you want.The code is simple, as long as you are familiar with ContentProvider. Public StaticListgetsystemphotolist (Context context) {ListNewArraylist(); Uri URI=MediaStore.Images.Media.EXTERNAL_CONTENT_URI; Contentresolver Contentresolver=Context.getcontentresolver (); Cursor Cursor= Contentresolver.query (URI,NULL,NULL,NULL,NULL); if(
??Common use of Imagepickercontroller to obtain DIC after using?UIImage *image = [dic objectforkey:@ "Uiimagepickercontrolleroriginalimage"];To get the original image, but I used this method to get the picture is not the original, but the size after compression, and then found a new way to get the direct sticker code?[CPP]? View Plaincopy
Alassetslibrary?*library?=? [[Alassetslibrary?alloc]?init];??
????? [Library?assetforurl:[dic?objectforkey:uiimagepickercontrollerreferenceurl]??
?????
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.