User-739566453 posted
Hi i have page to insert the client details. every thing was fine in my local system but i am getting some error while working onlie.
A generic error occurred in GDI+.
this is the code i have written.................................
const
int iSquare = 128;
int cxThumbnail, cyThumbnail;
f1 = new
FileInfo(File1.Value);
Stream s = File1.PostedFile.InputStream;
System.Drawing.Image img =
new System.Drawing.Bitmap(s);if
(img.Width > img.Height)
{
cxThumbnail = iSquare;
cyThumbnail = iSquare * img.Height / img.Width;
}
else
if (img.Height > img.Width)
{
cyThumbnail = iSquare;
cxThumbnail = iSquare * img.Width / img.Height;
}
else
{
cyThumbnail = iSquare;
cxThumbnail = iSquare;
}
img.GetThumbnailImage(cxThumbnail, cyThumbnail, null, (IntPtr)0).Save(mappath
+ f1.Name); // this is where i am getting the error
img.Save(mappath +
"\\" + f1.Name);
Server Error in '/' Application.
A generic error occurred in GDI+.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
Source Error:
Line 101: cxThumbnail = iSquare;
Line 102: }
Line 103: img.GetThumbnailImage(cxThumbnail, cyThumbnail, null, (IntPtr)0).Save(mappath + f1.Name);
Line 104: img.Save(mappath + "\\" + f1.Name);
Line 105: //img.GetThumbnailImage(300, 300, null, IntPtr.Zero).Save(mappath + "\\" + f1.Name);
|