locked
resizing image and save RRS feed

  • Question

  • User363772461 posted
    I really need help with this...

    <code>
    Dim OriginalImg As System.Drawing.Bitmap
    OriginalImg = System.Drawing.Bitmap.FromFile(thefile)
    Dim ScaledImage As System.Drawing.Bitmap = New System.Drawing.Bitmap(OriginalImg, imageWidth, imageHeight)
    'ScaledImage.Save(thefile, System.Drawing.Imaging.ImageFormat.Jpeg)
    ScaledImage.Save(Response.OutputStream, ImageFormat.Jpeg)
    </code>

    why does everything work if i use Response.OutputStream but i don't want to look at the picture, i want to save it to disc.
    How can i solve this?

    i get the error:
    System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+

    Please help!

    I just want to resize a picture and save it..
    Friday, July 1, 2005 4:14 PM

All replies

  • User1152494133 posted

    I would guess a permissions issue.  Ensure that your ASP.NET worker account (usually a local user on the web server named ASPNET) has write permissions to the directory that you specify in the Image.Save() method.

    Friday, July 1, 2005 6:46 PM
  • User-1641227678 posted
    Just a quick note that if you are using Windows Server 2003 the user account would be NETWORK SERVICE.

    Also be sure to use Server.MapPath when specifying the path to save.
    Tuesday, July 5, 2005 12:39 PM