473,385 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

GURU with Images

Hi can someone please tell me why I keep getting the following error and how I might fix it!

...::ERROR::..
Exception Details: System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.

The line causing the problem is outputImage.Save, but I really don't understand why, it works fine if I save the jpeg image in the wwwroot folder or even wwwroot/images but as soon as I make the folder structure any deeper I get the above error. Has anyone ever experience this before??? Can some please tell me how I fix the problem!!!

...::CODE::..
System.Drawing.Bitmap outputImage = new System.Drawing.Bitmap(origBitmap, newWidth, newHeight);
outputImage.Save(Server.MapPath(basePath + System.IO.Path.GetFileName(_FileName.Value)),Syste m.Drawing.Imaging.ImageFormat.Jpeg);

statusinfo.InnerHtml = "Uploaded " + Server.MapPath(basePath + System.IO.Path.GetFileName(_FileName.Value));
Thanks for any help!

Nov 18 '05 #1
4 1055
One thing to note is that the current image save sometimes ges back to
write the number of bytes. If you use the utput stream this will fail.
Create a memory stream write to that and then copy the memory stream too the
output buffer.

Hope that helps
Daryl

"Tim::.." <an*******@discussions.microsoft.com> wrote in message
news:5B**********************************@microsof t.com...
Hi can someone please tell me why I keep getting the following error and how I might fix it!
..::ERROR::..
Exception Details: System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
The line causing the problem is outputImage.Save, but I really don't understand why, it works fine if I save the jpeg image in the wwwroot folder
or even wwwroot/images but as soon as I make the folder structure any deeper
I get the above error. Has anyone ever experience this before??? Can some
please tell me how I fix the problem!!!
..::CODE::..
System.Drawing.Bitmap outputImage = new System.Drawing.Bitmap(origBitmap, newWidth, newHeight); outputImage.Save(Server.MapPath(basePath + System.IO.Path.GetFileName(_FileName.Value)),Syste m.Drawing.Imaging.ImageFor
mat.Jpeg);
statusinfo.InnerHtml = "Uploaded " + Server.MapPath(basePath + System.IO.Path.GetFileName(_FileName.Value));

Thanks for any help!

Nov 18 '05 #2
The "generic error" message is very frustrating in GDI+. It is a catch-all
message which is about all you're going to get from GDI+. From your
description, it sounds like you may have a permissions issue. Have you
checked the folder permissions for the folders you are trying to write to?

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Tim::.." <an*******@discussions.microsoft.com> wrote in message
news:5B**********************************@microsof t.com...
Hi can someone please tell me why I keep getting the following error and how I might fix it!
..::ERROR::..
Exception Details: System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
The line causing the problem is outputImage.Save, but I really don't understand why, it works fine if I save the jpeg image in the wwwroot folder
or even wwwroot/images but as soon as I make the folder structure any deeper
I get the above error. Has anyone ever experience this before??? Can some
please tell me how I fix the problem!!!
..::CODE::..
System.Drawing.Bitmap outputImage = new System.Drawing.Bitmap(origBitmap, newWidth, newHeight); outputImage.Save(Server.MapPath(basePath + System.IO.Path.GetFileName(_FileName.Value)),Syste m.Drawing.Imaging.ImageFor
mat.Jpeg);
statusinfo.InnerHtml = "Uploaded " + Server.MapPath(basePath + System.IO.Path.GetFileName(_FileName.Value));

Thanks for any help!

Nov 18 '05 #3
Actually from your code

basePath +
System.IO.Path.GetFileName(_FileName.Value));

Don't you need to put the / in between the basePath and filename.

Daryl

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:O1**************@TK2MSFTNGP09.phx.gbl...
The "generic error" message is very frustrating in GDI+. It is a catch-all
message which is about all you're going to get from GDI+. From your
description, it sounds like you may have a permissions issue. Have you
checked the folder permissions for the folders you are trying to write to?

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Tim::.." <an*******@discussions.microsoft.com> wrote in message
news:5B**********************************@microsof t.com...
Hi can someone please tell me why I keep getting the following error and how I might fix it!

..::ERROR::..
Exception Details: System.Runtime.InteropServices.ExternalException: A

generic error occurred in GDI+.

The line causing the problem is outputImage.Save, but I really don't

understand why, it works fine if I save the jpeg image in the wwwroot

folder or even wwwroot/images but as soon as I make the folder structure any deeper I get the above error. Has anyone ever experience this before??? Can some
please tell me how I fix the problem!!!

..::CODE::..
System.Drawing.Bitmap outputImage = new
System.Drawing.Bitmap(origBitmap, newWidth, newHeight);
outputImage.Save(Server.MapPath(basePath +

System.IO.Path.GetFileName(_FileName.Value)),Syste m.Drawing.Imaging.ImageFor mat.Jpeg);

statusinfo.InnerHtml = "Uploaded " + Server.MapPath(basePath +

System.IO.Path.GetFileName(_FileName.Value));


Thanks for any help!


Nov 18 '05 #4
I just noticed that he's using Server.MapPath() as part of his code. It is
possible that these "deeper" folders are not part of the folder structure of
his current ASP.Net app, which would cause an error when using this method.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Daryl" <Da***@somewhere.net> wrote in message
news:us**************@TK2MSFTNGP10.phx.gbl...
Actually from your code

basePath +
System.IO.Path.GetFileName(_FileName.Value));

Don't you need to put the / in between the basePath and filename.

Daryl

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:O1**************@TK2MSFTNGP09.phx.gbl...
The "generic error" message is very frustrating in GDI+. It is a catch-all message which is about all you're going to get from GDI+. From your
description, it sounds like you may have a permissions issue. Have you
checked the folder permissions for the folders you are trying to write to?
--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Tim::.." <an*******@discussions.microsoft.com> wrote in message
news:5B**********************************@microsof t.com...
Hi can someone please tell me why I keep getting the following error
and how I might fix it!

..::ERROR::..
Exception Details: System.Runtime.InteropServices.ExternalException: A

generic error occurred in GDI+.

The line causing the problem is outputImage.Save, but I really don't

understand why, it works fine if I save the jpeg image in the wwwroot

folder
or even wwwroot/images but as soon as I make the folder structure any

deeper
I get the above error. Has anyone ever experience this before??? Can some please tell me how I fix the problem!!!

..::CODE::..
System.Drawing.Bitmap outputImage = new System.Drawing.Bitmap(origBitmap,
newWidth, newHeight);
outputImage.Save(Server.MapPath(basePath +

System.IO.Path.GetFileName(_FileName.Value)),Syste m.Drawing.Imaging.ImageFor mat.Jpeg);

statusinfo.InnerHtml = "Uploaded " + Server.MapPath(basePath +

System.IO.Path.GetFileName(_FileName.Value));


Thanks for any help!



Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Useko Netsumi | last post by:
Hi, suppose I'd like to convert my JPG images(in a directory) into a lower resolution and uniform size(while maintaining its aspect ratio), I would I do that in PHP? I've seen code with PHP/GD...
2
by: Tim::.. | last post by:
Hi I'm trying to create a little application that shows an image of a user when you mouseover there details in a datagrid. The datagrid is populated from an Active Directory Database and I...
0
by: Tim::.. | last post by:
I have a datagrid that displays a list of contacts on our intranet site using the ActiveDirectory as it's main Data Source. I want to be able to show an image of each employee using a popup layer...
67
by: Scott M. | last post by:
Can anyone give me any ideas on why VS.NET 2003 running on XP Pro. (P4's with 1GB RAM) would take over 3 minutes to simply create a new ASP.NET Web Application on http://localhost? It seems that...
16
by: Singulus | last post by:
Hello all, I've searched for similar threads, I've found some bit of useful info here and there, but nevertheless I want to post my questions...So, how can I (we, in fact the forum can benefit...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.