Closed mapr-fr closed 7 years ago
I bypassed the problem by creating an interface in my PCL project and depencies in device apps to create an instance of IImage
from a base64 string.
iOS :
public IImage GetAvatarFromBase64string(string base64Avatar)
{
UIImage img = new UIImage(
Foundation.NSData.FromArray(
Convert.FromBase64String(base64Avatar)
)
);
return new CGImageImage(img.CGImage, 1);
}
Android :
public IImage GetAvatarFromBase64string(string base64Avatar)
{
var img = Android.Util.Base64.Decode(base64Avatar, Android.Util.Base64Flags.Default);
var avatar = Android.Graphics.BitmapFactory.DecodeByteArray(img, 0, img.Length);
return new BitmapImage(avatar, 1);
}
Problem solved :)
Hi,
I'm using NGraphics to create user's avatar in my Xamarin.Forms app. But I've an issue when I try to create an instance IImage from a MemoryStream created with a Base64 string. Here is my code :
When I execute this code, NGraphics throw this Exception :
Is there something I forgot?
Thanks :)