I want to resize the uploaded image before store at the server. And i have a issue when i call Bitmap.Save method but i don't know why. Please help me to resolve it if you have some ideas.
The Resize() method:
thanks,
Addition, this is the message in the log application viewer:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 7/6/2009 4:15:44 PM
Event time (UTC): 7/6/2009 9:15:44 AM
Event ID: ab2bc37e976848668289241ff6beabc0
Event sequence: 10
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: 49bf7a90-4-128913453314687500
Trust level: Full
Application Virtual Path: /WebSite5
Application Path: C:\Documents and Settings\Ngo Duc Huy\My Documents\Visual Studio 2008\WebSites\WebSite5\
Machine name: pc
Process information:
Process ID: 5396
Process name: WebDev.WebServer.EXE
Account name: pc\Ngo Duc Huy
Exception information:
Exception type: ExternalException
Exception message: A generic error occurred in GDI+.
Thread information:
Thread ID: 4
Thread account name: pc\Ngo Duc Huy
Is impersonating: False
Stack trace: at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(String filename, ImageFormat format)
at Test.Common.ImageHelper.ResizeImage(Int32 maxWidth, Int32 maxHeight, Stream stream, String fileName) in c:\Documents and Settings\Ngo Duc Huy\My Documents\Visual Studio 2008\WebSites\WebSite5\App_Code\ImageHelper.cs:line 70
at _Default.btnUpload_Click(Object sender, EventArgs e) in c:\Documents and Settings\Ngo Duc Huy\My Documents\Visual Studio 2008\WebSites\WebSite5\Default.aspx.cs:line 28
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Custom event details:
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
None
0 Points
9 Posts
Resize image issue
Jul 06, 2009 05:54 AM|huynd|LINK
Dear all,
I want to resize the uploaded image before store at the server. And i have a issue when i call Bitmap.Save method but i don't know why. Please help me to resolve it if you have some ideas.
The Resize() method:
thanks,
Addition, this is the message in the log application viewer:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 7/6/2009 4:15:44 PM
Event time (UTC): 7/6/2009 9:15:44 AM
Event ID: ab2bc37e976848668289241ff6beabc0
Event sequence: 10
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: 49bf7a90-4-128913453314687500
Trust level: Full
Application Virtual Path: /WebSite5
Application Path: C:\Documents and Settings\Ngo Duc Huy\My Documents\Visual Studio 2008\WebSites\WebSite5\
Machine name: pc
Process information:
Process ID: 5396
Process name: WebDev.WebServer.EXE
Account name: pc\Ngo Duc Huy
Exception information:
Exception type: ExternalException
Exception message: A generic error occurred in GDI+.
Request information:
Request URL: http://localhost:2079/WebSite5/default.aspx
Request path: /WebSite5/default.aspx
User host address: 127.0.0.1
User: pc\Ngo Duc Huy
Is authenticated: True
Authentication Type: NTLM
Thread account name: pc\Ngo Duc Huy
Thread information:
Thread ID: 4
Thread account name: pc\Ngo Duc Huy
Is impersonating: False
Stack trace: at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(String filename, ImageFormat format)
at Test.Common.ImageHelper.ResizeImage(Int32 maxWidth, Int32 maxHeight, Stream stream, String fileName) in c:\Documents and Settings\Ngo Duc Huy\My Documents\Visual Studio 2008\WebSites\WebSite5\App_Code\ImageHelper.cs:line 70
at _Default.btnUpload_Click(Object sender, EventArgs e) in c:\Documents and Settings\Ngo Duc Huy\My Documents\Visual Studio 2008\WebSites\WebSite5\Default.aspx.cs:line 28
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Custom event details:
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
<input id="gwProxy" type="hidden"><input onclick="jsCall();" id="jsProxy" type="hidden">
<div id="refHTML"></div>None
0 Points
9 Posts
Re: Resize image issue
Jul 06, 2009 10:27 PM|huynd|LINK
hic, nobody can help me!!!! It is my urgent issue now. Please help me to resolve it ?
Thank you very much,
Member
22 Points
109 Posts
Re: Resize image issue
Jul 10, 2009 10:21 PM|KCrow|LINK
Have you made sure that you have a bitmap to save? You will get this if there is no bitmap to save.
None
0 Points
9 Posts
Re: Resize image issue
Jul 14, 2009 04:47 AM|huynd|LINK
hic, thank you all very much. I don't know why but today this function is running very well withough i didn't update any code.
<input id="gwProxy" type="hidden"><input onclick="jsCall();" id="jsProxy" type="hidden">
<div id="refHTML"></div>