Getting Started - Resizing images in ASP Print E-mail

Example of using Image Console in ASP

To make this work, Place the ImageConsole.exe in the current folder where the uploaded images reside. That is more convenient as the normal path of the ImageConsole.exe has spaces. For what I want, is to have 3 sizes of images, 50,170 and 300 pixels height. Create in the image folder 3 sub folders and name them 50,170 and 300.

Create an asp page and add this code to run the ImageConsole.exe after the new images are uploaded. I tested it with JPG and GIF images and it works fine.

OPTION EXPLICIT
On Error Resume Next
dim WshShell
Dim runPath
Dim strPath
Dim oExec
Dim strExtension
DIM intres
Dim strMemNumber 

strMemNumber = "0000028_1.JPG"

strPath = lCase(Trim(server.MapPath("ImageConsole.exe")))

strPath = Trim(Replace(strPath,"imageconsole.exe",""))

strExtension = UCase(right(strMemNumber,3))

Set WShShell = Server.CreateObject("WScript.Shell")

'Height = 50

runPath = strPath & "ImageConsole.exe /overwrite /resize /height:50 /type:" & strExtension & " " & strPath & strMemNumber & " " & strPath & "50"

intres = WshShell.Run (RunPath,1,true)

'Height = 170

runPath = strPath & "ImageConsole.exe /overwrite /resize /height:170 /type:" & strExtension & " " & strPath & strMemNumber & " " & strPath & "170"

intres = WshShell.Run (RunPath,1,true)

'Height = 300

runPath = strPath & "ImageConsole.exe /text /align:1 /textleft:0 /texttop:20 /red:247 /green:255 /blue:0 /font:" & chr(34) & "Times New Roman " & chr(34) & " /string:" & chr(34) & "www.Like2Date.com" & chr(34) & " /textsize:20 /textweight:10 /underline /overwrite /resize /height:300 /type:" & strExtension & " " & strPath & strMemNumber & " " & strPath & "300"

intres = WshShell.Run (RunPath,1,true)

Response.Write ("runPath = " & runPath & "<HR>")
Response.Write ("strPath = " & strPath & "<HR>")
Response.Write ("strExtension = " & strExtension & "<HR>")
Response.Write ("error = " & intres & "<HR>")

set WshShell = Nothing

Special thanks to Mike from http://www.296.com/ for this code.