How to choose a picture from photo library on iPhone ?

Hi guys,
I am trying to upload a picture in "Photos"(I mean phone photos library) from the app. Actually I don't know how to code it.
Can you suggest me for this issue ?
Thanks in advance.

Hi Raiden -
RaidenMAC wrote:
I am trying to upload a picture in "Photos"(I mean phone photos library) from the app.
Well this is a 3-part project:
1) To allow the user to select a photo from the iPhone library, create an instance of [UIImagePickerController|http://developer.apple.com/library/ios/#documentation/ UIKit/Reference/UIImagePickerControllerClass/UIImagePickerController/UIImagePickerController.html%23//appleref/doc/uid/TP40007070]:
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:picker animated:YES];
[picker release];
2) To get the data from the selected photo, implement [imagePickerController:didFinishPickingMediaWithInfo:|http://developer.apple.co m/library/ios/documentation/UIKit/Reference/UIImagePickerControllerDelegateProtocol/UIImagePickerControllerDelegate/UIImagePickerControllerDelegate.html#// appleref/doc/uid/TP40007069-CH3-SW8] in the picker controller's delegate:
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage* image = [info objectForKey:UIImagePickerControllerOriginalImage];
NSData *jpegData = UIImageJPEGRepresentation (image, 1.0);
// dismiss controller and start upload here
3) Upload the jpeg data. Of course the details will depend on the site (E.g. see [ObjC - Post a UIImage by using NSData and NSURLRequest?|http://stackoverflow.com/questions/743903/objc-post-a-uiimage-by- using-nsdata-and-nsurlrequest]).
If you've never uploaded image data or an image file to a web site, step 3 is going to be the hardest, and in that case I would rcommend another thread with a title like "How to upload image to URL". Hopefully that will get the attention of programmers who have more experience with that topic than I do. Anyway it's an entirely different subject than you've described in the title of this thread.
Even if you have experience uploading data, I would recommend working on steps 1 and 2 first. You could check your work by adding these lines to the delegate example above:
BOOL result = [jpegData writeToFile:@"/Users/Raiden/Picture.jpeg" atomically:NO];
NSLog(@"jpegData=%@ result=%d", jpegData, result);
Once you get the desired picture into your test file, you can work on the upload, confident that your source data is correct.
- Ray

Similar Messages

  • How to delete duplicate pictures from Photo Library

    How to delete duplicate pictures from Photo Library in iPhone 3G 16 giga?

    The only way to delete photos from the photo library is by the same way the photos were transferred to your iPhone - via the iTunes sync process.
    Are you saying a photo or all photos transferred to your iPhone via the iTunes sync process are duplicated in your iPhone's Photo Library without being duplicated in the folder on your computer where these photos are stored?

  • How do I transfer pictures from Photo library to iPhoto library?

    How do I transfer pictures from Photo library to iPhoto library?

    You do not export to IPhoto - you export to the desktop and then import from there into iPhoto - then delete form the desktop
    two separate steps
    [1] Export from Photos and [2] import into iPhoto
    LN

  • How to sync pictures from "Photo Library" on iphone 4 to computer to manage them?

    This is my senerio! I recently got an iPhone 4...before this phone, i had a Droid through Verizon. Yet, this iPhone 4 service is still through Verizon. When i got the iPhone, i wanted all my pictures from my old phone, the Droid, on this iPhone. The people at Verizon transferred them over. Those pictures were put into the "Photo Library" of my iPhone. I only have say...about maybe 200 pictures. They were all duplicated, many many times! So now i have over 800 of the same pictures in my "Photo Library" how do i delete the duplicates?? I've noticed i cannot delete pictures using the trash can through "Photo Library" you have to be in the Camera Roll to do so. Here are my big questions...
    1. How do i delete pictures off my phone through "Photo Library" without deleting them all?!
    2. How do i get the photos from "Photo Library" onto my computer, or iTunes to be able to manage them?!
    I want to pick and choose then delete. I do not want to delete my WHOLE Photo Library.
    Again, remember, i never got these already photos from a computer, i got them from another phone!
    Someone, please help me! This is so ridiculous!

    The photo sync is one way - computer to iphone.
    You ould have to e-mail them to yourself.  When you sync photos to your iphone the current pics will be deleted.
    The iphone is not a storage device, it simply mirrors the selected content of your computer.

  • How do I delete photo albums from phone and how do I delete pictures from photo library on phone.

    how do I delete photo albums from my phone and how do I delete pictures from library on my phone

    If you sync those album via itunes, then you will need to unsync them via itunes.

  • HT4972 how do I delete pictures from photo library

    I do I delete phots from the photo library

    To delete photos from your device
    In iTunes, select the device icon in the Devices list on the left. Click the Photos tab in the resulting window.
    Choose "Sync photos from."
    On a Mac, choose iPhoto or Aperture from the pop-up menu.
    On a Windows PC, choose Photoshop Album or Photoshop Elements from the pop-up menu.
    Choose "Selected albums" and deselect the albums or collections you want to delete.
    Click Apply.

  • How do I move pictures from one library to another?

    How do I move pictures from one library to another?

    For just a few export them out of Library A via the File ➙ Export ➙ File Export menu option with Kind = Original and import them into Library B.
    However, this will not include any edits or metadata (keywords, titles, etc.) that you've added.
    To get the original image, any edits and all metadata, keywords, titles, descriptions, places, etc., you'll need the paid version of  iPhoto Library Manager.  It can copy albums or events from one library to another and keep those items I mentioned earlier with the photos.
    OT

  • How do you take pictures from one library and put in another library??

    How do you take pictures from one library and put in another library??

    Options:
    1. Export from iPhoto A to the Finder, then import to iPhoto B
    This gets the photo over, but no versions, no edit history and not all the metadata
    2. Use iPhoto Library Manager
    This gets everything: versions, edit history and all the metadata.
    Regards
    TD

  • How do I save pictures from my library to the external sd card on my droid x2

    How do I save pictures from my library to the external sd card on my droid x2?

    Are the pictures already in the iPhoto Library?  If so just drag them onto the slideshow title in the left hand source pane.
    OT

  • How do I transfer pictures from messages on my iPhone to my photo library

    How do I transfer pictures from IM (messages) on my iPhone to my photo library?

    Hi patricew9,
    Welcome to the Support Communities!
    The link below will show you how to save photos in Messages to your iPhone's camera roll.  You can then get photos from your iPhone into your computer by using Photo Stream, or importing directly into the computer.   I'll include more information for you below:
    Save a photo or video you received in Messages - Message - iPhone Basics - Apple Support
    http://support.apple.com/kb/TI88#TI88
    To save a photo or video you received in Messages, tap the photo or video to open it fully. Tap the Share icon in the bottom left corner of the screen.  Then tap Save Image to save it to your Camera Roll.
    iOS: Importing personal photos and videos from iOS devices to your computer
    http://support.apple.com/kb/HT4083
    If you have an iCloud account, you can also enable Photo Stream on your iPhone and your computer to sync photos:
    iCloud: Set up Photo Stream
    http://support.apple.com/kb/PH2605
    Cheers,
    - Judy

  • How do you delete pictures from photo stream on ipad2

    Can't delete pictures from photo stream on iPad 2

    The links below have instructions for deleting photos.
    iOS and iPod: Syncing photos using iTunes
    http://support.apple.com/kb/HT4236
    iPad Tip: How to Delete Photos from Your iPad in the Photos App
    http://ipadacademy.com/2011/08/ipad-tip-how-to-delete-photos-from-your-ipad-in-t he-photos-app
    Another Way to Quickly Delete Photos from Your iPad (Mac Only)
    http://ipadacademy.com/2011/09/another-way-to-quickly-delete-photos-from-your-ip ad-mac-only
    How to Delete Photos from iPad
    http://www.wondershare.com/apple-idevice/how-to-delete-photos-from-ipad.html
    How to: Batch Delete Photos on the iPad
    http://www.lifeisaprayer.com/blog/2010/how-batch-delete-photos-ipad
    (With iOS 5.1, use 2 fingers)
    How to Delete Photos from iCloud’s Photo Stream
    http://www.cultofmac.com/124235/how-to-delete-photos-from-iclouds-photo-stream/
     Cheers, Tom

  • Cannot remove pictures from photo library

    hi everyone... somebody can help me to delete pictures in photo library?

    To remove images in the Photo Library you need to use iTunes.
    iTunes puts those images on the iPhonel it syncs them from a source on your computer.
    So you need to use iTunes to 'unsync' those images to remove them.
    Hope it helps.

  • Deleting photos from photo library on iphone

    Hello people,
    i am a new user of iphone and i am not able to figure out the solution for deleting photos from the photo library of iphone.please help me out with this.i will be very glad if i am provided with the solution.

    To add even more details and help
    One thing about the iPhone and Windows users (not sure what happens with Mac users) is when you first get your iPhone and hook up to your computer and go into iTunes to go do your first sync. The default for where it will get your photos to sync is the "My Pictures" folder for your user profile.
    Many realize after that first sync that they just synced tons of junk they never really wanted on the phone (as for many Windows users, there are sample pics, temp pics, etc all in that folder and subfolders.
    You will find it far easier to go make a folder someplace on your computer.
    For Example:
    C:\IPHONEPICS (though I personally wouldn't make it at the root like that, but this is just for example)
    Then COPY pictures you want to go to your iPhone into that folder.
    Then back in iTunes for the Photos option (tab) for the iPhone, choose the option to select a different folder other than "My Pictures" (drop down).
    Browse and select that folder you made.
    Now when you sync it will sync with that folder that you explictly put photos you want on your iPhone.
    The reason I said put copies there is that later if you want a photo off your phone, just delete it from that folder on you computer then sync. And when you want new pics on your phone, just put copies in that folder and sync. Far easier to manage.
    As a final tip. In that folder you are allowed to make sub folders to make Libraries on your phone. But note, you can only go one folder deep.
    For example:
    C:\IPHONEPICS is what you made to sync to.
    Now you can create in there
    C:\IPHONEPICS\FAMILY
    C:\IPHONEPICS\PARTY
    C:\IPHONEPICS\MISC
    C:\IPHONEPICS\GIRLNEXTDOOR
    And put copies of pics into each of those folders. They will be different libraries on your phone. But note you cannot create:
    C:\IPHONEPICS\FAMILY\WIFE
    As that is two subfolders deep.

  • How do I transfer pictures from Iphoto to my iphone 5

    How do I transfer pictures from iphoto on my macbook to my iphone5 ?

    See Here  >  Syncing photos to devices
    From Here  >  http://support.apple.com/kb/HT4236

  • HT4236 how can i sync pictures from my pc to iphone

    I would like to know how can i sync pictures from my PC into my iPhone... "FREME BY FREME".
    Not complete folders... just picture by picture ... select one picture and sync that picture!!!

    Hi Randers4
    Thanks for the help, this tip solve my question.
    Take care from,
    Riavlapaul.

Maybe you are looking for

  • Invoking a AXIS Web Service with a Java object as input argument

    Hi I've been trying to execute a bpel process that invokes a web service deployed through axis. This web service takes a java object as input argument as opposed to data types that are directly mapped to java types through the SOAP engine. I deployed

  • Ipod touch 1st generation fully charged apple logo comes up but freezes before it turns on

    i have a 1st generation ipod touch and i borrowed it to a friend for a while. she deleted everything that was on it when she gave it back to me. but now i'm trying to put it back onto my computer and it was dead now when i try to start it the apple l

  • Keeps asking for source file.

    As I work on a project, I save-as the file name for example: This (myproj.mxml) to this (myproj02.mxml) until eventually I save as up to 5 or 10 files. (myproj08.mxml) in the package explorer list on the left side of the flex builder project. When I

  • RMAN Restore - continue from a failed point?

    Hi All, While cloning a db using RMAN, We get RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: ================================================

  • Printing a cookbook title page

    My wife and I are trying to print a cookbook title page using an image with a title over the image. However, the print sometimes blurs or is lighter than the image. How can we print the text over the image without distorting the text?  Also, we are l