在媒体库中显示和保存图像 [英] Show and save images from/in media library

查看:111
本文介绍了在媒体库中显示和保存图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在Windows Phone 7和VS 2010中制作一个小应用程序.
我正在使用此代码将摄像机捕获的图像保存在媒体库对象中.
但它不能保存.

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是ImageSource对象,image1是图像控件,
myMediaLibrary是MediaLibrary对象)

1.在哪里可以找到该媒体库集合?
2.除了编码以外,还有什么其他方法可以编辑?
3.有什么方法可以清除媒体库?



(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?

推荐答案

请参阅 ^ ]

一些更多信息(已解决类似问题):
http://social.msdn.microsoft.com/Forums/zh/windowsphone7series/thread/62eb891f-0474-4c90-9c36-7418bbd548d0 [
See Photos Sample[^]

Some more info here (Similar problem solved):
http://social.msdn.microsoft.com/Forums/en/windowsphone7series/thread/62eb891f-0474-4c90-9c36-7418bbd548d0[^]

Regards
Espen Harlinn


这篇关于在媒体库中显示和保存图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆