[Mono-list] Generic Error GDI+
acrym
soreric94 at gmail.com
Wed Nov 13 07:29:25 UTC 2013
Centos 5.8 x86, Apache 2.2, Mono 3.1.1, mod-mono 2.10, xsp 2.10
*I have libgdiplus 2.10 installed*
On a WCF service I try to download an image from a specified URL and then
save it on the server.
*
I do not think it is a permissions issue because System.IO.File.WriteAllText
to the same directory works*
The error given is:
Message:Generic Error [GDI+ status: GenericError]
Stack Trace: at System.Drawing.GDIPlus.CheckStatus (Status status)
[0x00000] in <filename unknown>:0
at System.Drawing.Image.Save (System.String filename,
System.Drawing.Imaging.ImageCodecInfo encoder,
System.Drawing.Imaging.EncoderParameters encoderParams) [0x00000] in
<filename unknown>:0
at System.Drawing.Image.Save (System.String filename,
System.Drawing.Imaging.ImageFormat format) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.Drawing.Image:Save
(string,System.Drawing.Imaging.ImageFormat)
at xxxxx.Web.Service1.saveImage (System.String imgname, System.String url)
[0x00000] in <filename unknown>:0
Source:System.Drawing
----------------------------------------
The code:
----------------------------------------
Stream stream = null;
MemoryStream stream2 = null;
byte[] bytes = InetConnection(url);
stream = new MemoryStream(bytes);
System.Drawing.Bitmap bmp = new
System.Drawing.Bitmap(stream, false);
Bitmap newImage = new Bitmap(55, 81);
Graphics gr = Graphics.FromImage(newImage);
gr.DrawImage(bmp, new Rectangle(0, 0, 55, 81));
stream2 = new MemoryStream();
newImage.Save(stream2,
System.Drawing.Imaging.ImageFormat.Jpeg);
System.IO.File.WriteAllBytes(System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath
+ "img/" + imgname + ".jpg", stream2.ToArray());
--
View this message in context: http://mono.1490590.n4.nabble.com/Generic-Error-GDI-tp4661310.html
Sent from the Mono - General mailing list archive at Nabble.com.
More information about the Mono-list
mailing list