jkwasson
asked on
A generic error occurred in GDI+ (trying to do image.save)
I have the following code. I am trying to create and save a .gif file. This works fine on my development box, but when I upload it to my hosted server, it fails with the error listed below. I have done some reading and this would indicate that I have a permissions issue on that folder, but I have verified that on my hosted server the anonymous permissions for the folder I am writing to allow for read/write. I am stumped...any help would be greatly appreciated.
My Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim Image As Image
Dim tmpImage As Image
Dim bmMap As Bitmap
Dim bmLogo As Bitmap
Dim bmTemp As Bitmap
Dim gMap As Graphics
Dim strLogoPath As String = Server.MapPath("graphics/m t_pushpin. gif")
Dim strMapPath As String = Server.MapPath("maps/us_nv .gif")
Dim strBasePath As String = Server.MapPath(".")
bmLogo = New Bitmap(strLogoPath)
bmMap = New Bitmap(strMapPath)
'create a temp bitmap that we will generate the new state image from
bmTemp = New Bitmap(606, 336)
tmpImage = bmTemp
'overlay the state map onto the blank image
gMap = Graphics.FromImage(tmpImag e)
gMap.DrawImage(bmMap, 0, 0)
'draw the bullets on the image
gMap.DrawImage(bmLogo, 200, 300)
gMap.DrawImage(bmLogo, 52, 44)
'save the image
Dim strTemp As String
strTemp = Server.MapPath("maps/us_nv _new.gif")
Image = tmpImage
Response.Write(strTemp & "<br>")
Image.Save(strTemp, System.Drawing.Imaging.Ima geFormat.G if)
End Sub
THE ERROR i AM GETTING:
Exception Details: System.Runtime.InteropServ ices.Exter nalExcepti on: A generic error occurred in GDI+.
stack trace:
[ExternalException (0x80004005): A generic error occurred in GDI+.]
System.Drawing.Image.Save( String filename, ImageCodecInfo encoder, EncoderParameters encoderParams) +581
System.Drawing.Image.Save( String filename, ImageFormat format) +61
MTDealerMap.gditest.Page_L oad(Object sender, EventArgs e) in c:\inetpub\wwwroot\MTDeale rMap\gdite st.aspx.vb :62
System.Web.UI.Control.OnLo ad(EventAr gs e) +67
System.Web.UI.Control.Load Recursive( ) +35
System.Web.UI.Page.Process RequestMai n() +750
Thanks!
jk
My Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim Image As Image
Dim tmpImage As Image
Dim bmMap As Bitmap
Dim bmLogo As Bitmap
Dim bmTemp As Bitmap
Dim gMap As Graphics
Dim strLogoPath As String = Server.MapPath("graphics/m
Dim strMapPath As String = Server.MapPath("maps/us_nv
Dim strBasePath As String = Server.MapPath(".")
bmLogo = New Bitmap(strLogoPath)
bmMap = New Bitmap(strMapPath)
'create a temp bitmap that we will generate the new state image from
bmTemp = New Bitmap(606, 336)
tmpImage = bmTemp
'overlay the state map onto the blank image
gMap = Graphics.FromImage(tmpImag
gMap.DrawImage(bmMap, 0, 0)
'draw the bullets on the image
gMap.DrawImage(bmLogo, 200, 300)
gMap.DrawImage(bmLogo, 52, 44)
'save the image
Dim strTemp As String
strTemp = Server.MapPath("maps/us_nv
Image = tmpImage
Response.Write(strTemp & "<br>")
Image.Save(strTemp, System.Drawing.Imaging.Ima
End Sub
THE ERROR i AM GETTING:
Exception Details: System.Runtime.InteropServ
stack trace:
[ExternalException (0x80004005): A generic error occurred in GDI+.]
System.Drawing.Image.Save(
System.Drawing.Image.Save(
MTDealerMap.gditest.Page_L
System.Web.UI.Control.OnLo
System.Web.UI.Control.Load
System.Web.UI.Page.Process
Thanks!
jk
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
cool, thanks for the points
ASKER
Thanks,
jk