Click here to Skip to main content
15,899,754 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hye,
i m making a small app in windows phone 7, VS 2010.
I m using this code to save camera captured image in media library object.
but it is not saving.

byte[] imageBits = new byte[(int)e.ChosenPhoto.Length];
             e.ChosenPhoto.Read(imageBits, 0, imageBits.Length);
              e.ChosenPhoto.Seek(0, SeekOrigin.Begin);
              MediaLibrary library = new MediaLibrary();
           myMediaLibrary.SavePicture("TestPhoto", imageBits);




Also, i've tried to show the existing photos in media library.
it is also not working.

Uri url = new Uri(string.Format(@"Images/{0}", myMediaLibrary.SavedPictures[0]), UriKind.RelativeOrAbsolute);

    imgsrc = new BitmapImage(url);
    image1.Source = imgsrc;
    image1.Visibility = System.Windows.Visibility.Visible;


(imgsrc is a ImageSource object, image1 is a image control,
myMediaLibrary is a MediaLibrary object)

1. where can i found this media library collection physically?
2. is there any way to edit it other than coding?
3. is there any way to clear the media library?
Posted

1 solution

 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 11-Jan-11 10:37am    
Hm. Very good - a 5.
Espen Harlinn 11-Jan-11 10:59am    
Thanks SAKryukov!
DeepsMann 18-Jan-11 1:04am    
Thanks,

it was a busy week, so i was absent for long.

I've done this as
e.ChosenPhoto.Seek(0, 0);
MediaLibrary ml = new MediaLibrary();
ml.SavePicture("CaptureFileName", e.ChosenPhoto);

and it is saving the camera captured photo in a folder named "Saved Pictures"
is there any way to save it in the existing folder "Camera Roll"


btw thanks for ur reply.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900