Getting Started - a newbie's take
Posted: 2010-12-22T16:02:29-07:00
Helpful Information from one Newbie to another on Getting Started
I didn't have much fun or much luck finding all of this information when I needed it. So I thought others might need it in the future and decided to put it together.
My environment: Windows 7, Classic ASP, VBScript
Installation:
Problem: Partial Installation, not working from the command line (cmd)
Solution: Ran the installation again using 'Run as administrator' (If it still doesn't work, I'd log into the generic administrator account on the computer/server and repeat the process.)
Problem: Worked great from the command line, but couldn't get the object created in ASP 'Server.CreateObject Failed'
Solution: Manually registered the DLL through the command line: regsvr32 "C:\Program Files\ImageMagick-6.6.6-Q16\ImageMagickObject.dll"
Problem: ASP page executed without errors, but the image didn't convert
Solution: the IUSR for the computer/server must have permission to read and/or write on the directories of the old image, the new image, and the computer's/server's default TEMP/TMP directory
Basic Information (each example build on the previous)
Creating the Object in Visual Basic Script
Simple conversion from one type to another
OR
Find out information about an image
(Output should be the type of image/file: GIF, JPEG, PDF etc)
For a complete list of available keywords: http://www.imagemagick.org/script/identify.php
For a complete list of properties (the %letters...):http://www.imagemagick.org/script/escape.php
I hope that this helps others.
I didn't have much fun or much luck finding all of this information when I needed it. So I thought others might need it in the future and decided to put it together.
My environment: Windows 7, Classic ASP, VBScript
Installation:
Problem: Partial Installation, not working from the command line (cmd)
Solution: Ran the installation again using 'Run as administrator' (If it still doesn't work, I'd log into the generic administrator account on the computer/server and repeat the process.)
Problem: Worked great from the command line, but couldn't get the object created in ASP 'Server.CreateObject Failed'
Solution: Manually registered the DLL through the command line: regsvr32 "C:\Program Files\ImageMagick-6.6.6-Q16\ImageMagickObject.dll"
Problem: ASP page executed without errors, but the image didn't convert
Solution: the IUSR for the computer/server must have permission to read and/or write on the directories of the old image, the new image, and the computer's/server's default TEMP/TMP directory
Basic Information (each example build on the previous)
Creating the Object in Visual Basic Script
Code: Select all
Dim img
Set img = Server.CreateObject("ImageMagickObject.MagickImage.1")
Code: Select all
img.Convert "fullpathtoimage", "fullpathtonewimage"
OR
Code: Select all
Dim origImg, newImg, msgs
origImg = "C:\someimage.jpg"
newImg = "C:\someimage.gif"
msgs = img.Convert(origImg, newImg)
Find out information about an image
Code: Select all
Dim format, imgHeight, imgWidth, imgFileSize, imgMultipleProperties
format = img.Identify("-format", "%m", origImg)
(Output should be the type of image/file: GIF, JPEG, PDF etc)
Code: Select all
imgHeight = img.Identify("-format","%h", origImg)
imgWidth = img.Identify("-format","%w", origImg)
imgFileSize = img.Identify("-format", "%b", origImg)
imgMultipleProperties = img.Identify("-format", "%wx%h, %b", origImg)
For a complete list of available keywords: http://www.imagemagick.org/script/identify.php
For a complete list of properties (the %letters...):http://www.imagemagick.org/script/escape.php
I hope that this helps others.