Domanda

As described in this thread's first answer, for WP8 the Camera Capture Task automatically saves a copy of any images it creates to the Camera Roll. If an image is saved in this way, is it possible to programmatically surface the image in an application directly from the copy in the Camera Roll without creating a second copy in a location such as Isolated Storage or Application Data? If so, how would you get a pointer to the Camera Roll location of this newly-saved image?

I'd like to avoid having multiple redundant copies of each image floating around, if at all possible. And if using the copy in the Camera Roll will allow me to leverage the CameraCaptureTask functionality instead of working with the Camera API directly, then this would be ideal for my purposes. Thanks.

È stato utile?

Soluzione

If you just need the location of the image it is provided in the OriginalFileName property of the PhotoResult that you get from the Completed event.

For example, take a picture with the emulator gives "C:\Data\Users\Public\Pictures\Camera Roll\WP_20140106_002.jpg"

Now that you have it you can display to the user with a BitMapImage and set that as the Source for an image.

MyImage.Source = new BitmapImage(new Uri("C:\\Data\\Users\\Public\\Pictures\\Camera Roll\\WP_20140106_002.jpg", UriKind.Absolute));

If you need the image right away, you get that from the ChosenPhoto property of the PhotoResult.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top