Is there a way to convert an System.Drawing.Image to an System.Web.UI.WebControls.Image? Im getting the image from an XML file, the binary being in base 64 string. I then convert it back to an array of bytes. My problem is that I can't find a way to create
the System.Web.UI.WebControls.Image with a Stream or an array of bytes... I got the Image from Drawing but I can't convert it back to a WebControl Image. I suppose I must write down the file somewhere on the server then return the path but I dont want to leave
these temporary images on the drive. Any ideas or suggestion anyone? Thanks Carl
that's not the way it works. you point the src of the webcontrols.image to an aspx script which then writes the drawing.image to the response stream. you can't just convert one into the other directly
RTFM - straight talk for web developers. Unmoderated, uncensored, occasionally unreadable
Your solution worked ok Atrax, but I would like to know if you know another way to do this? I mean, suppose you have a byte[] with the file in it. What do you do with it to make it show? You want to use the .ImageUrl property because passing in parameter a
base64 string will chop the string and you will get a "base64 char array" error. What im thinking at the moment is having the aspx page reparse the XML file given the ID in parameter then return it to the Response. You think there may be another solution than
having to reparse the file? Thanks Carl
not really - if you're outputting HTML you need to have separate files for HTML and images (at present). if you were just outputting a PDF you might be able to do it this way, but presumably you're using HTML, meaning two separate files (or calls to the same
file with different parameters).
RTFM - straight talk for web developers. Unmoderated, uncensored, occasionally unreadable
FYI: you dont need to store it anywhere.. you can put all the graphic code on one aspx page, and in the end of that page, write on the page image.aspx...
and on the page that you want to show the picture...
good thing is you can still pass querystring parameters to image.aspx if needed.. bad thing is that
the image gets created all the darn time. I dont know exactly what it does to your performance, but I know it doesnt do any good.
hexenjag
Member
315 Points
63 Posts
System.Drawing.Image TO System.Web.UI.WebControls.Image
May 18, 2004 08:34 PM|LINK
Atrax
All-Star
18705 Points
3733 Posts
Re: System.Drawing.Image TO System.Web.UI.WebControls.Image
May 19, 2004 05:04 AM|LINK
Jason Brown - MVP, IIS
hexenjag
Member
315 Points
63 Posts
Re: System.Drawing.Image TO System.Web.UI.WebControls.Image
May 19, 2004 12:22 PM|LINK
hexenjag
Member
315 Points
63 Posts
Re: System.Drawing.Image TO System.Web.UI.WebControls.Image
May 19, 2004 06:23 PM|LINK
Atrax
All-Star
18705 Points
3733 Posts
Re: System.Drawing.Image TO System.Web.UI.WebControls.Image
May 20, 2004 12:18 AM|LINK
Jason Brown - MVP, IIS
southbayray
Member
230 Points
46 Posts
Re: System.Drawing.Image TO System.Web.UI.WebControls.Image
May 25, 2004 06:25 PM|LINK
christiantoi...
Member
435 Points
86 Posts
Re: System.Drawing.Image TO System.Web.UI.WebControls.Image
Jul 30, 2004 06:03 AM|LINK
Software Consultant
Dev360.com, LLC
christiantoi...
Member
435 Points
86 Posts
Re: System.Drawing.Image TO System.Web.UI.WebControls.Image
Jul 30, 2004 06:05 AM|LINK
Software Consultant
Dev360.com, LLC