|
<%@ Page AspCompat="true"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=x-sjis">
<title>ik9_server.asp</title>
</head>
<body>
<%
Dim ImageKit1, Ret, Ret2, filename,
filename2, count, theImage
Dim blur, canvas, emboss, lens,
glasstile, mosaic, motionblur, oilpaint, outline, ripple
Dim rotation, waves, whirlpinch,
gray, none
Dim kinkakuji, tajmahal, italy,
sanfrancisco
' サーバ上でImageKit8コンポーネントのインスタンスの作成
ImageKit1 =
Server.CreateObject("ImageKit9ImageKit")
' 処理するファイル名の設定
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
' ファイルをロード
Ret2=ImageKit1.File.LoadFile(0)
blur=""
gray=""
canvas=""
emboss=""
lens=""
glasstile=""
mosaic=""
motionblur=""
oilpaint=""
outline=""
ripple=""
rotation=""
waves=""
whirlpinch=""
' ドロップダウンメニューにより、エフェクトコント処理の選択
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 "mosaic"
Ret =
ImageKit1.Effect.Mosaic(0, 0, 0, 10, 10)
mosaic = "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
' JPEGの品質を設定
ImageKit1.File.JpegQuality = 75
' 処理されたイメージのファイル名を設定
Dim filestring,strNow
' 現在の日時を取得してコロンなどを削除
strNow=now
strNow = Replace(strNow,":","")
strNow = Replace(strNow," ","")
strNow = Replace(strNow,"/","")
' 長さを統一する
If len(strNow)
< 14 then
Dim strRight,strLeft
strRight = Right(strNow,5)
strLeft = Left(strNow,8)
strRight = "0" & strRight
strNow = strLeft & strRight
End If
'ファイル名の作成
filestring=Session.SessionID & strNow & ".jpg"
filename2= "c:\myServer\myFolder\" & filestring
ImageKit1.File.FileName = filename2
' JPEGにイメージを保存
Ret = ImageKit1.File.SaveFile(2,0)
' サーバ上のオブジェックトを開放
ImageKit1 =
nothing
filestring="temp/" & filestring
Dim dir
dir = "c:\myServer\myFolder\"
Dim objFSO, objFolder, objFile
objFSO =
Server.CreateObject("Scripting.FileSystemObject")
objFolder =
objFSO.GetFolder(dir)
For Each objFile
in objFolder.Files
' ファイルが作成された日時を取得
Dim strMade
strMade=objFile.DateCreated
'コロンなどを削除
strMade = Replace(strMade,":","")
strMade = Replace(strMade," ","")
strMade = Replace(strMade,"/","")
' 長さを統一する
If
len(strMade) < 14 then
Dim
strRight1,strLeft1
strRight1 =
Right(strMade,5)
strLeft1 =
Left(strMade,8)
strRight1 = "0" &
strRight1
strMade = strLeft1 &
strRight1
End If
' 現在の日時を取得
Dim currentTime
' 現在の日時を取得してコロンなどを削除
currentTime=now
currentTime = Replace(currentTime,":","")
currentTime = Replace(currentTime," ","")
currentTime = Replace(currentTime,"/","")
' 長さを統一する
If
len(currentTime) < 14 then
Dim
strRight2,strLeft2
strRight2 =
Right(currentTime,5)
strLeft2 =
Left(currentTime,8)
strRight2 = "0" &
strRight2
currentTime = strLeft2
& strRight2
End If
' 10秒より古ければそのイメージファイルを削除
If CurrentTime
- strMade > 10 then
Ret2=objFSO.DeleteFile(objFile, False)
End If
Next
objFolder =
nothing
objFSO = nothing
%>
<form action="Ik9_Server.aspx" method="post" id=form1
name=form1>
<div>
<center>
<table border="0">
<tr>
<td colspan="3"
align="center">
<font
size="6" color="#0000ff"><b>ImageKit9</font>
<font
size="4"> - オンライン ASPX サンプル</b></font>
</td>
</tr>
<tr>
<td
colspan="3"> </td>
</tr>
<tr>
<td colspan="3">
ドロップダウンメニューからイメージとエフェクト処理を選択し、ボタンを押してください。
</td>
</tr>
<tr>
<td
colspan="3"> </td>
</tr>
<tr>
<td
align="center">オリジナルイメージ</td>
<td> </td>
<td
align="center">処理されたイメージ</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
name="image">
<option
<%Response.Write(italy)%>
value = "italy">ローマ</option>
<option
<%Response.Write(kinkakuji)%>
value = "kinkakuji">金閣寺</option>
<option
<%Response.Write(tajmahal)%>
value = "tajmahal">タージマハル</option>
<option
<%Response.Write(sanfrancisco)%>
value = "sanfrancisco">サンフランシスコ</option>
</td>
<td> </td>
<td
align="center">エフェクト処理の選択
<select
name="effect">
<option
<%Response.Write(none)%>
value = "none">なし</option>
<option
<%Response.Write(gray)%>
value = "gray">グレースケール</option>
<option
<%Response.Write(blur)%>
value = "blur">ぼかし</option>
<option
<%Response.Write(canvas)%>
value = "canvas">キャンバス</option>
<option
<%Response.Write(emboss)%>
value = "emboss">エンボス</option>
<option
<%Response.Write(lens)%>
value = "lens">レンズ</option>
<option
<%Response.Write(glasstile)%>
value = "glasstile">ガラスタイル</option>
<option
<%Response.Write(mosaic)%>
value = "mosiac">モザイク</option>
<option
<%Response.Write(motionblur)%>
value = "motionblur">モーションぼかし</option>
<option
<%Response.Write(oilpaint)%>
value = "oilpaint">油絵</option>
<option
<%Response.Write(outline)%>
value = "outline">輪郭抽出</option>
<option
<%Response.Write(ripple)%>
value = "ripple">波紋</option>
<option
<%Response.Write(rotation)%>
value = "rotation">回転</option>
<option
<%Response.Write(waves)%>
value = "waves">さざなみ</option>
<option
<%Response.Write(whirlpinch)%>
value = "whirlpinch">ねじりツマミ</option>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="center"
colspan="3">
<input
type = "submit" value="エフェクト処理" id=submit1 name=submit1>
<input
type = "hidden" name="count" value="1">
</td>
</tr>
</table>
</center>
</div>
</form>
</body>
</html>
|
|