01.
<%
Option
Explicit %>
02.
<html>
03.
<head>
04.
<title>ThaiCreate.Com ASP Resize Images</title>
05.
</head>
06.
<body>
07.
<b>Oritial Size</b><br>
08.
<img src=
"mygirl.jpg"
>
09.
<hr>
10.
<b>
New
Size</b>
11.
<br>
12.
<%
13.
Dim
Chs, objConst,NewWidth,NewHeight
14.
Dim
FileName,OutFormat,OutFileName
15.
FileName =
"mygirl.jpg"
16.
OutFormat =
"Jpg"
17.
OutFileName =
"MyResize/mygirl.jpg"
18.
NewWidth =
"100"
19.
NewHeight = 0
20.
21.
22.
Dim
objFso,myImg,Width,Height
23.
Set
objFso = CreateObject(
"Scripting.FileSystemObject"
)
24.
IF objFso.FileExists(Server.MapPath(FileName))
Then
25.
set myImg = Loadpicture(Server.MapPath(FileName))
26.
Width = Round(myImg.width / 26.4583)
27.
Height = Round(myImg.height / 26.4583)
28.
NewHeight = Round((NewWidth*Height)/Width)
29.
30.
31.
End
If
32.
33.
34.
Set
Chs = Server.CreateObject(
"OWC10.ChartSpace"
)
35.
Set
objConst = Chs.Constants
36.
37.
Chs.Interior.SetTextured Server.MapPath(FileName), objConst.chStretchPlot, , objConst.chAllFaces
38.
Chs.border.color = -3
39.
40.
41.
42.
43.
Chs.ExportPicture Server.MapPath(OutFileName),OutFormat,NewWidth,NewHeight
44.
45.
Set
objConst =
Nothing
46.
Set
Chs =
Nothing
47.
%>
48.
<img src=
"<%=OutFileName%>"
>
49.
</body>
50.
</html>