Image from memorystream

Hello,
I would like to know if it's possible with the Image Blazor component to load the image from a MemoryStream. My images are not in a folder of the webserver. but I get them using FTP.
with this Code I load the file into a memory stream:

FtpWebResponse response = (FtpWebResponse)request.GetResponse();
using (System.IO.MemoryStream stream = new MemoryStream())
{ response.GetResponseStream().CopyTo(stream);

                        Image1.ImageUrl = "data:image/jpg;base64," + Convert.ToBase64String(stream.ToArray(), 0, stream.ToArray().Length);

                    }

is it possible to load the Image using the memorystream ?
thank you .

Hey @cedpromedical,

You can post your question in StackOverflow since it’s not related to Radzen.

1 Like

here a possible solution:

  1. From Radzen Editor in the page LOAD . create a property called "myimageurl"
  2. From Radzen Editor bind your image component url to the property just created.
  3. Create a method to set the myimageurl content from code in a way like this:
    myimageurl="data:image/jpg;base64," + Convert.ToBase64String(stream.ToArray(), 0, stream.ToArray().Length);
    where "stream" is your memorystream that contain the image data.
    best regards.
2 Likes