locked
Resize image issue RRS feed

  • Question

  • User-381159405 posted

    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"><!--Session data--><input onclick="jsCall();" id="jsProxy" type="hidden">

    Monday, July 6, 2009 5:54 AM

Answers

  • User-381159405 posted

    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"><!--Session data--><input onclick="jsCall();" id="jsProxy" type="hidden">

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 14, 2009 4:47 AM

All replies

  • User-381159405 posted

    hic, nobody can help me!!!! It is my urgent issue now. Please help me to resolve it ?

    Thank you very much,

    Monday, July 6, 2009 10:27 PM
  • User1233494541 posted

     Have you made sure that you have a bitmap to save? You will get this if there is no bitmap to save.

    Friday, July 10, 2009 10:21 PM
  • User-381159405 posted

    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"><!--Session data--><input onclick="jsCall();" id="jsProxy" type="hidden">

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 14, 2009 4:47 AM