|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=x-sjis">
<title>ik8_server.asp</title>
</head>
<body>
<%
Dim ImageKit1, Ret, filename,
filename2, count, theImage
Dim blur, canvas, emboss, lens,
glasstile, mosaic, motionblur, oilpaint, outline, ripple
Dim rotation, waves, whirlpinch,
grey, none
Dim kinkakuji, tajmahal, italy,
sanfrancisco
' Create an instance of the ImageKit
Control
Set ImageKit1 =
Server.CreateObject("ImageKit8.ImageKit")
' Set the filename of the file to be used
If Request("image") =
"kinkakuji" then
theImage = "kinkakuji.jpg"
kinkakuji = "selected"
Elseif Request("image") =
"tajmahal" then
theImage = "tajmahal.jpg"
tajmahal = "selected"
Elseif Request("image") =
"sanfrancisco" then
theImage = "sanfrancisco.jpg"
sanfrancisco = "selected"
Else
theImage = "italy.jpg"
italy = "selected"
End If
ImageKit1.File.FileName = "c:\myServer\myFolder\" &
theImage
' load the file
ImageKit1.File.LoadFile 0
blur=""
canvas=""
emboss=""
lens=""
glasstile=""
mosaic=""
motionblur=""
oilpaint=""
outline=""
ripple=""
rotation=""
waves=""
whirlpinch=""
' Select the effect filter depending on the
drop down menu selection
Dim m_effect
m_effect = Request("Effect")
Select Case m_effect
Case "blur"
Ret =
ImageKit1.Effect.Blur(0,0,0,5)
blur = "selected"
Case "canvas"
Ret =
ImageKit1.Effect.Canvas(0, 0, 10, 1, 20)
canvas = "selected"
Case "emboss"
Ret =
ImageKit1.Effect.Emboss(0, 0, 0, 3, 5, 100)
emboss = "selected"
Case "lens"
Ret =
ImageKit1.Effect.Lens(0, 0, 0, 3, False, 0, 0,0)
lens = "selected"
Case "glasstile"
Ret =
ImageKit1.Effect.GlassTile(0, 0, 0, 40, 20)
glasstile = "selected"
Case "mosiac"
Ret =
ImageKit1.Effect.Mosaic(0, 0, 0, 10, 10)
mosiac = "selected"
Case "motionblur"
Ret =
ImageKit1.Effect.MotionBlur(0, 0, 0, 2, 10, 0)
motionblur = "selected"
Case "oilpaint"
Ret =
ImageKit1.Effect.OilPaint(0, 0, 0, 1, 10)
oilpaint = "selected"
Case "outline"
Ret =
ImageKit1.Effect.Outline(0, 0, 0, 1, 1, 30)
outline = "selected"
Case "ripple"
Ret =
ImageKit1.Effect.Ripple(0, 0, 0, 5, 1, 5, 1, 0, 0, 0, 0)
ripple = "selected"
Case "rotation"
Ret =
ImageKit1.Effect.Rotation(4500, 0, 0, 1, 255, 255, 255, 1)
rotation = "selected"
Case "waves"
Ret =
ImageKit1.Effect.Waves(0, 0, 0, 0, 1, 10, 5, 5, 0, 0, 0, 0)
waves = "selected"
Case "whirlpinch"
Ret =
ImageKit1.Effect.WhirlPinch(0, 0, 0, 360, 1, 1, 0, 0, 0)
whirlpinch = "selected"
Case "gray"
Ret =
ImageKit1.Effect.SetGray()
gray = "selected"
Case Else
Ret =
ImageKit1.Effect.Rotation(0,0,0,0,0,0,0,0)
none = "selected"
End Select
' Set the JPEG quality
ImageKit1.File.JpegQuality = 75
' set the filename of the processed image
Dim filestring,strNow
' remove colons, commas, and slashes from
the current time
strNow=now
strNow = Replace(strNow,":","")
strNow = Replace(strNow," ","")
strNow = Replace(strNow,"/","")
' make sure all the strings are the same
length
If len(strNow)
< 14 then
Dim strRight,strLeft
strRight = Right(strNow,5)
strLeft = Left(strNow,8)
strRight = "0" & strRight
strNow = strLeft & strRight
End If
'create the file
filestring=Session.SessionID & strNow & ".jpg"
filename2= "c:\myServer\myFolder\" & filestring
ImageKit1.File.FileName = filename2
' save the image as a JPEG
Ret = ImageKit1.File.SaveFile(2,0)
' Clean up the objects
Set ImageKit1 =
nothing
filestring="temp/" & filestring
Dim dir
dir = "c:\myServer\myFolder\"
Set objFSO =
Server.CreateObject("Scripting.FileSystemObject")
Set objFolder =
objFSO.GetFolder(dir)
For Each objFile
in objFolder.Files
' retrieve the date time
when the file was created
Dim strMade
strMade=objFile.DateCreated
'remove commas, colons,
and slashes
strMade = Replace(strMade,":","")
strMade = Replace(strMade," ","")
strMade = Replace(strMade,"/","")
' make sure the strings
are the same length
If
len(strMade) < 14 then
Dim
strRight1,strLeft1
strRight1 =
Right(strMade,5)
strLeft1 =
Left(strMade,8)
strRight1 = "0" &
strRight1
strMade = strLeft1 &
strRight1
End If
' retrieve the current
time
Dim currentTime
' remove commas, colons,
and slashes
currentTime=now
currentTime = Replace(currentTime,":","")
currentTime = Replace(currentTime," ","")
currentTime = Replace(currentTime,"/","")
' make sure the strings
are the same length
If
len(currentTime) < 14 then
Dim
strRight2,strLeft2
strRight2 =
Right(currentTime,5)
strLeft2 =
Left(currentTime,8)
strRight2 = "0" &
strRight2
currentTime = strLeft2
& strRight2
End If
' if an image is more
than 10 seconds older than the created image, delete it
If CurrentTime
- strMade > 10 then
objFSO.DeleteFile
objFile, False
End If
Next
Set objFolder =
nothing
Set objFSO = nothing
%>
<form action="Ik8_Server.asp" method="post" id=form1
name=form1>
<div>
<center>
<table border="0">
<tr>
<td colspan="3"
align="center">
<font
size="6" color="#0000ff"><b>ImageKit8</font>
<font
size="4"> - Online ASP Sample </b></font>
</td>
</tr>
<tr>
<td
colspan="3"> </td>
</tr>
<tr>
<td colspan="3">
Select
an image and an effect filter from the drop down menus, then click the button
</td>
</tr>
<tr>
<td
colspan="3"> </td>
</tr>
<tr>
<td
align="center">Original Image</td>
<td> </td>
<td
align="center">Processed Image</td>
</tr>
<tr>
<td><img
src="i/<%Response.Write theImage%>"></td>
<td> </td>
<td>
<%
If
request("count") <> "" then
If
request("image") = "none" then
Response.Write
"<img src='http://myServer/myFolder/" & theImage & "'>"
Else
Response.Write
"<img src='http://myServer/myFolder/" & filestring & "'>"
End
If
Else
Response.Write
"<img src='http://myServer/myFolder/" & theImage & "'>"
End
If
%>
</td>
</tr>
<tr>
<td
align="center">Select an Image
<select
name="image">
<option
<%Response.Write italy%>
value = "italy">Italy</option>
<option
<%Response.Write kinkakuji%>
value = "kinkakuji">Kinkakuji</option>
<option
<%Response.Write tajmahal%>
value = "tajmahal">Taj Mahal</option>
<option
<%Response.Write sanfrancisco%>
value = "sanfrancisco">Golden Gate</option>
</td>
<td> </td>
<td
align="center">Select an Effect
<select
name="effect">
<option
<%Response.Write none%>
value = "none">None</option>
<option
<%Response.Write gray%>
value = "gray">Grayscale</option>
<option
<%Response.Write blur%>
value = "blur">Blur</option>
<option
<%Response.Write canvas%>
value = "canvas">Canvas</option>
<option
<%Response.Write emboss%>
value = "emboss">Emboss</option>
<option
<%Response.Write lens%>
value = "lens">Lens</option>
<option
<%Response.Write glasstile%>
value = "glasstile">Glasstile</option>
<option
<%Response.Write mosiac%>
value = "mosiac">Mosiac</option>
<option
<%Response.Write motionblur%>
value = "motionblur">Motion Blur</option>
<option
<%Response.Write oilpaint%>
value = "oilpaint">Oilpaint</option>
<option
<%Response.Write outline%>
value = "outline">Outline</option>
<option
<%Response.Write ripple%>
value = "ripple">Ripple</option>
<option
<%Response.Write rotation%>
value = "rotation">Rotate</option>
<option
<%Response.Write waves%>
value = "waves">Waves</option>
<option
<%Response.Write whirlpinch%>
value = "whirlpinch">Whirlpinch</option>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="center"
colspan="3">
<input
type = "submit" value="Apply Effect" id=submit1 name=submit1>
<input
type = "hidden" name="count" value="1">
</td>
</tr>
</table>
</center>
</div>
</form>
</body>
</html>
|
|