The purpose of this documentation is to inform and help you with anything related to Imager Resizer.
Sections: Main - Installation and syntax - What's new - FAQ - Contact
Requirements for Imager Resizer
- Webhost with a cgi-bin folder with "Scripts and Executables" permissions.
Installation Instructions for Imager Resizer
- Unzip the zipfile on your local computer.
- Upload Imager.dll to any directory with "Scripts and Executables" permission on your webserver. In most cases this would be /cgi-bin/.
- When it has been uploaded you can check if it works by opening your webbrowser and going to the adress of the dll and adding the test parameters. It would look something like this: http://www.mysite.com/cgi-bin/Imager.dll?Test=True. Note that Test=True is case sensitive to typing test=true won't work. It should say that Imager v1.4 is working fine and it shouldn't try to download anything. If it does then you don't have the correct permissions set for the directory.
- That should be it. If you are having problems feel free to contact me!
A note for Windows 2003 Server users
- Due to some new security features in IIS6 you have to "introduce" any ISAPI application to the server to be able to run it. I was able to locate an article on the net about this. I've copied the relevant part below and for those who want to see the whole article the link is avaible below.
- "First of all, you need to "introduce" your code (ISAPI or CGI) to the new IIS 6. In order to do this, go to IIS MMC and "allow" your DLL (or CGI exe) in Web Service Management branch of the left panel tree."
- Found at: http://ksajadi.com/dflat/archives/000011.html
Syntax
- Image - Specifies the full path to the image.
- Width - Specifies the width of the image.
- Height (Optional) - Specifies the height of the image. If left out, it will be proportional to the set width.
- Compression (Optional) - Specifies the width of the image. Defaults to 80 and only work with JPEG and PNG images.
- Output (Optional) - Specifies the output format. Valid values are .jpg .gif .png and .tga. Note that it won't work without the dot at the start.
- AutoRotate (Optional) - Tells if the dll shall switch the width and height of a image depending on it's orientation. Valid values are "true" and "false". If left out it defaults to "true".
- Whitespace (Optional) - Tells the dll to create a proportional resize and then fill the rest of the image with white to add up to the specified Width and Height. This is useful if you want images to become the same output size even if differently shaped. Valid values are "true" and "false". If left out it defaults to "false".
Example (Simple resize)
- <img src="/cgi-bin/Imager.dll?Image=C:\MyImage.jpg&Width=200&Height=150&Compression=80">
- The above example would load C:\MyImage.jpg and resize it to 200x150 pixels. It will set the compression rate to 80 and then send the resulting image to the client. Imager Resizer won't allow to open any files other then JPG, PNG, BMP, TIFF, TGA and GIF so it can't really hurt you even though it needs the absolute path. An easy way to get the absolute path from a webpath is using the asp function Server.Mappath().
Example (Saving thumbnail to disk. Advanced)
- dim xml, strImagerDLL, bData, FileName, Width, Height
FileName = "myimage.jpg"
Width = 200
Height = 150
strImagerDLL = "http://www.mysite.com/cgi-bin/Imager.dll"
Set xml = Server.CreateObject("Microsoft.XMLHTTP") ' Creates an instance of MSXML4, if this fails, create a "MSXML2.ServerXMLHTTP" instead and remove False from the end of next line
xml.Open "POST", strImagerDLL & "?Image=" & Server.Mappath(FileName) & "&Width=" & Width & "&Height=" & Height, False
xml.Send()
bData = xml.ResponseBody
Set xml = nothing
dim oStream
Set oStream = Server.CreateObject("ADODB.Stream")
oStream.type = 1 'adTypeBinary
oStream.mode = 3 'adModeReadWrite
oStream.open
oStream.write bData
oStream.Position = 0
oStream.SaveToFile server.mappath("thumbnails/" & FileName)
oStream.Close
Set oStream = Nothing
- The above example would use MSXML HTTP to access Imager Resizer which would load MyImage.jpg and resize it to 200x150 pixels. It will then write the result into a ADODB Stream object which will save it to the thumbnails directory.