This topic is locked

Help with CreateThumbnail Code : ASPImage v2.31

1/25/2009 7:54:22 AM
ASPRunnerPro General questions
M
Maurits author

Hi

Can anyone help me with re-writing or can someone provide me with the code in CreateThumbnail with ASPImage v2.31 in CommonFuntions.asp please?
My ISP has installed ASPImage v2.31 and Jane has said in the last reply that i had to re-write the CreateThumbnail in commonfunctions.asp

I have done this, but still can't get it to work... I have done it probably wrong!
Documentation for AspImage:

http://www.serverobjects.com/comp/Aspimage.htm
The code i have so far:

function CreateThumbnail(value, size, ext)

dim Image

Set Image = Server.CreateObject("AspImage.Image")
if isnull(Image) then

CreateThumbnail=value

exit function

end if
on error resume next
Image.OpenBinary value

if err.number<>0 then

CreateThumbnail=value

on error goto 0

exit function

end if
on error goto 0
dim sx,sy
sx = Image.MaxX

sy = Image.MaxY
if sx<=size and sy<=size or sx=0 or sy=0 then

CreateThumbnail=value

exit function

end if
if sx>=sy then

Image.MaxY=sy*size/sx

Image.MaxX=size

else

Image.MaxX=sx*size/sy

Image.MaxY=size

end if
dim ret
Image.ImageFormat=1
Image.Resize Image.MaxX, Image.MaxY
CreateThumbnail=Image.Image
Set Image = Nothing
end function


I am storing the images in an database field. Original size and another field the thumbnail.

So far with this code it stores both pictures in the database as the original size.
Could anyone help me with this code please?
Many thanks
Maurits