I writ a basic cropping script. In VBscript. As follows:
<%Set Jpeg = Server.CreateObject("Persits.Jpeg")
getsec = DateDiff("s","01/01/04",now())
filename = "screenshots/"&getsec&".png"
imgfile = request("imgfile")
Jpeg.Open Server.MapPath(imgfile)
Jpeg.Crop 0, 38, 320, 460
Jpeg.Canvas.DrawPNG 0, 0, Server.MapPath("watermark.png")
Jpeg.PNGOutput = True
Jpeg.Save Server.MapPath(filename)
%>
<%=filename%>
However instead of hard coding these variables:
Jpeg.Crop 0, 38, 320, 460
I would like someway of using vbscript to find out the image size before I crop it, so that if different image sizes are uploaded the script can be more flexible. Anyone know how to do this?
Your
Jpegobject (ASPJpeg instance) has.OriginalWidthand.OriginalHeightproperties which are accessible after invoking.Openmethod. You can use them.