[Mono-bugs] [Bug 67383][Maj] New - Response.OutputStream problem
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Sat, 2 Oct 2004 11:02:58 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by jan@patware.si.
http://bugzilla.ximian.com/show_bug.cgi?id=67383
--- shadow/67383 2004-10-02 11:02:58.000000000 -0400
+++ shadow/67383.tmp.4961 2004-10-02 11:02:58.000000000 -0400
@@ -0,0 +1,103 @@
+Bug#: 67383
+Product: Mono: Class Libraries
+Version: unspecified
+OS:
+OS Details: debian 2.6.7
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: Sys.Drawing.
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: jan@patware.si
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc: gonzalo@ximian.com,jordi@ximian.com,rkumar@novell.com
+Summary: Response.OutputStream problem
+
+This a problem with showing images, that are created on fly in C# using
+ASP.NET. Ravindra has take some time to investigate this problem but he did
+not find out where is a problem. This is what his wrote me:
+
+Response.OutputStream is basically a MemoryStream object. And, I found
+that System.Drawing is able to write to a MemoryStream object locally. I
+have a test program that shows this behavior (attached writeimage.cs).
+Somehow, it is not able to get thru the Response.OutputStream. I'm still
+not sure, if this is a problem in System.Drawing or XSP.
+
+This a code, where problem is (Ravindra has make some changes, to be able
+to test it easily):
+
+using System;
+using System.IO;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Drawing.Drawing2D;
+using System.Drawing.Text;
+
+namespace ImageWriteOnFly
+{
+ /// <summary>
+ /// Summary description for writeOnimage.
+ /// </summary>
+ public class writeOnimage
+ {
+ public static void Main ()
+ {
+ string datoteka = "image.jpg";
+//Request["file"].ToString();
+ string napis = "image title";
+//Request["write"].ToString();
+ // "polozaj" is x where to start writing
+ int polozaj = napis.Length;
+ polozaj = 37-((polozaj-1)*4);
+
+ //Load the Image to be written on.
+ Bitmap bitMapImage = new System.Drawing.Bitmap(
+datoteka); //Server.MapPath(datoteka) );
+ Graphics graphicImage = Graphics.FromImage(
+bitMapImage );
+
+ //Smooth graphics is nice.
+ graphicImage.SmoothingMode = SmoothingMode.AntiAlias;
+
+
+ SolidBrush drawBrush = new SolidBrush(Color.White);
+
+ //Write your text.
+ graphicImage.DrawString( napis, new Font("Times New
+Roman CE", 12,FontStyle.Bold ), drawBrush, new Point( polozaj, 7 ) );
+
+ //Set the content type
+ //Response.ContentType="image/jpeg";
+
+ MemoryStream ms = new MemoryStream ();
+ //Save the new image to the response output stream.
+ //bitMapImage.Save(Response.OutputStream,
+ImageFormat.Jpeg);
+ //bitMapImage.Save("response.jpg", ImageFormat.Jpeg);
+ bitMapImage.Save(ms, ImageFormat.Jpeg);
+ FileStream fs = new FileStream ("response.jpg",
+FileMode.Create);
+ fs.Write (ms.GetBuffer(), 0, (int) ms.Length);
+
+
+ //Clean house.
+ graphicImage.Dispose();
+ bitMapImage.Dispose();
+ }
+ }
+}
+
+Status:
+The image on the pages are not shown.
+
+Versions:
+My current version is 1.0.1
+
+Test can be seen on http://bober.patware.si:1214/test/ when my comuter is on.
+
+Do you need more information?
+
+Jan