Saving picture on webpage problem. [modified]
-
I really have no idear how I get html file when I am trying to save chart picture on my webpage. This is the problem look like.. I sent some variables from page "A" to page "B" those values i need in creating chart process. It worked fine through showing the chart picture and when I moved mouse over the picture it shows the diskette icon to save picture and then I clicked save I got the html file it was "A" webpage. And sound funny every page that i linked from page "A" it got the same problem example page "C" it didn't get any variable from page "A" but it still got the same problem but again when I try to view only page C by set [Set As Start Page] property and then clicked run then I tried to save the picture again it work fine!!! I don't really understand which part of page "A" that make every page doesn't work right ???? What's causing the problem? Oh.. I need to tell you that the first two times it doesn't cause any problem but other times I will get this problem. Here is example code the most likely I wrote...
==========================================================================
Graphics g;
Bitmap b = new Bitmap(300, 499);
g = Graphics.FromImage(b);
Response.ContentType = "Image/Gif";g.Clear(Color.Transparent);
g.FillRectangle(new SolidBrush(Color.Black), 0, 0, 300, 499);
b.Save(Response.OutputStream, ImageFormat.Gif);
b.Dispose();
g.Dispose();Any suggestion will be really appreciate,sir. Thank you million, -- modified at 22:49 Thursday 5th July, 2007
junior boy
-
I really have no idear how I get html file when I am trying to save chart picture on my webpage. This is the problem look like.. I sent some variables from page "A" to page "B" those values i need in creating chart process. It worked fine through showing the chart picture and when I moved mouse over the picture it shows the diskette icon to save picture and then I clicked save I got the html file it was "A" webpage. And sound funny every page that i linked from page "A" it got the same problem example page "C" it didn't get any variable from page "A" but it still got the same problem but again when I try to view only page C by set [Set As Start Page] property and then clicked run then I tried to save the picture again it work fine!!! I don't really understand which part of page "A" that make every page doesn't work right ???? What's causing the problem? Oh.. I need to tell you that the first two times it doesn't cause any problem but other times I will get this problem. Here is example code the most likely I wrote...
==========================================================================
Graphics g;
Bitmap b = new Bitmap(300, 499);
g = Graphics.FromImage(b);
Response.ContentType = "Image/Gif";g.Clear(Color.Transparent);
g.FillRectangle(new SolidBrush(Color.Black), 0, 0, 300, 499);
b.Save(Response.OutputStream, ImageFormat.Gif);
b.Dispose();
g.Dispose();Any suggestion will be really appreciate,sir. Thank you million, -- modified at 22:49 Thursday 5th July, 2007
junior boy
Trouble is by generating the graphic on the fly like this there isn't actually any file for the browser to grab and save - you will need to save the file to the (server's) filesystem first in your graphics routine, and then set an image's src property to point to that... (or rather, an asp:Image ImageUrl=...)
-
Trouble is by generating the graphic on the fly like this there isn't actually any file for the browser to grab and save - you will need to save the file to the (server's) filesystem first in your graphics routine, and then set an image's src property to point to that... (or rather, an asp:Image ImageUrl=...)
First,Thank you very much for your replied. Now I have some idea that you might right but I have never done this before. Please you tell me or suggest how can i learn about this. Any code example will be really appreciate. I need to get it work tomorrow my deadline to send this project to my teacher. Please reply this I am waiting for you,sir. Thank you million,
junior boy
-
First,Thank you very much for your replied. Now I have some idea that you might right but I have never done this before. Please you tell me or suggest how can i learn about this. Any code example will be really appreciate. I need to get it work tomorrow my deadline to send this project to my teacher. Please reply this I am waiting for you,sir. Thank you million,
junior boy
Well..I mean, instad of b.Save(Response.OutputStream, ImageFormat.Gif); have b.Save(Server.MapPath("fred.gif", System.Drawing.Imaging.ImageFormat.Gif); Then you can set the ImageUrl property of an asp:Image control to the same file: asp:Image ImageUrl="fred.gif"
-
Well..I mean, instad of b.Save(Response.OutputStream, ImageFormat.Gif); have b.Save(Server.MapPath("fred.gif", System.Drawing.Imaging.ImageFormat.Gif); Then you can set the ImageUrl property of an asp:Image control to the same file: asp:Image ImageUrl="fred.gif"
Thank gosh! Thank you very much sir Mr.Fred Smith Now I got it worked. I am so happy :) Thank you million now my school project really done! :) Hope you have nice day:rose:
junior boy