we're using GdPicture Light Imaging Toolkit Ver. 4.12.0 (just updated) in our asp application and we're experiencing some problem. During intense use (multiple access to the function we use to process/resize images) we get the following error: "Unexpected error. A trappable error (C0000005) occurred in an external object."
To make things come back to work again we've to recycle the application. We've already tried to isolate the application in order to give it specific resources but nothing changed.
This is the function we use. May you please help us to solve the issue?
- Code: Select all
function resizeImage(imageFileName,resizedFileName,newWidth,newHeight)
Dim resized
Dim nImageID
isPNGImage = false
resized = false
jpgQuality = 95
jpgInterpolation = 7
jpgContrast = 8
white960 = Server.MapPath ("white.jpg")
if len(trim(imageFileName)) > 0 and len(trim(resizedFileName)) > 0 then
if isNumeric(newWidth) and isNumeric(newHeight) then
Set oGdPicture = Server.CreateObject("gdpicture4.imaging")
oGdPicture.SetLicenseNumber(Application("GDPictureLicenceNumber"))
nARGBWhiteColor = oGdPicture.ARGB(255, 255, 255, 255)
nImageID = oGdPicture.CreateImageFromFile(imageFileName)
if oGdPicture.GetImageFormat() = "PNG" then
oGdPicture.ConvertTo32BppARGB()
nImagePNG = oGdPicture.GetNativeImage
nImageBackground = oGdPicture.CreateImageFromFile(white960)
oGdPicture.SetNativeImage (nImageBackground)
call oGdPicture.DrawImage(nImagePNG, 1, 1, oGdPicture.GetWidth, oGdPicture.GetHeight)
end if
if newWidth > 0 then
if newHeight > 0 then
if nImageID <> 0 then
oGdPicture.SetContrast(jpgContrast)
oGdPicture.ResizeImage newWidth, newHeight, jpgInterpolation
oGdPicture.SaveAsJPEG resizedFileName, jpgQuality
oGdPicture.CloseNativeImage()
resized = true
end if
else
if nImageID <> 0 then
oGdPicture.SetContrast(jpgContrast)
oGdPicture.ResizeWidthRatio newWidth,jpgInterpolation
oGdPicture.SaveAsJPEG resizedFileName, jpgQuality
oGdPicture.CloseNativeImage()
resized = true
end if
end if
else
if newHeight > 0 then
if nImageID <> 0 then
oGdPicture.SetContrast(jpgContrast)
oGdPicture.ResizeHeightRatio newHeight, jpgInterpolation
oGdPicture.SaveAsJPEG resizedFileName, jpgQuality
oGdPicture.CloseNativeImage()
resized = true
end if
end if
end if
set oGdPicture = nothing
end if
end if
resizeImage = resized
end function
Thanks for your help
