Hey guys,
I am trying to persist a user photo by converting it to a byte array.
The initial placeholder image is loaded using xaml and static resources.
The holdup is, that ImageSource is a XF Element which doesn't seem to expose the Stream, but only stores the value for display.
This is how I am currently converting the Image to a byte array:
private byte[] ImageRaw { get; set; }
[Ignore]
public MemoryStream Image
{
get { return new MemoryStream(ImageRaw); }
set
{
ImageRaw = new byte[value.Length];
value.Read(ImageRaw, 0, ImageRaw.Length);
Persist();
}
}
Then I'll simple fetch the stream and use it for an ImageSource:
ImageSource.FromStream(() => Profile.Image);
Now, I am trying to figure out how to do it the other way around, something like this:
var stream = ImageSource.FromResource(ImageResources.DemoGirl).GET_THE_UNDERLYING_STREAM();
myUserProfile.Image = stream;
Does anyone know how to do this?
Or if it is possible at all.
Thanks in advance.