<%Option Explicit%>
<html>
<head>
<title>ThaiCreate.Com ASP & Upload and Resize</title>
</head>
<body>
<%
Dim sFileName,strPath
Dim mySmartUpload
strPath = "MyResize"
'*** Upload By aspSmartUpload ***'
'*** Create Object ***'
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
'*** Upload Files ***'
mySmartUpload.Upload
'** Getfile Name ***'
sFileName = mySmartUpload.Files("file1").FileName
If sFileName <> "" Then
'*** Upload **'
mySmartUpload.Files("file1").SaveAs(Server.MapPath(strPath&"/"&sFileName))
'********* Resize Images *******'
Response.write("<b>Oritial Size</b><br><img src=MyResize/"&sFileName&"><hr>")
Response.write("<b>New Size</b>")
Dim Chs, objConst,NewWidth,NewHeight
Dim OutFormat,OutFileName
OutFormat = "Jpg" '*** Gif,Png ***'
OutFileName = "Thumbnails_"&sFileName
NewWidth = "100" '*** Set new Width , Height automatic caculate ***'
NewHeight = 0 '*** Auto Resize ***'
'*** Get Images Width & Height ***'
Dim objFso,myImg,Width,Height
Set objFso = Server.CreateObject("Scripting.FileSystemObject")
IF objFso.FileExists(Server.MapPath(strPath&"/"&sFileName)) Then
set myImg = Loadpicture(Server.MapPath(strPath&"/"&sFileName))
Width = Round(myImg.width / 26.4583)
Height = Round(myImg.height / 26.4583)
NewHeight = Round((NewWidth*Height)/Width)
'NewHeight = 100
'NewWidth = Round((NewHeight*Width)/Height) '*** or Automatic Height ***'
End If
'*************** End *************'
Set Chs = Server.CreateObject("OWC10.ChartSpace")
Set objConst = Chs.Constants
Chs.Interior.SetTextured Server.MapPath(strPath&"/"&sFileName), objConst.chStretchPlot, , objConst.chAllFaces
Chs.border.color = -3
'Chs.border.color = &H0000FF
'Chs.border.Weight = 3
Chs.ExportPicture Server.MapPath(strPath&"/"&OutFileName),OutFormat,NewWidth,NewHeight
Set objConst = Nothing
Set Chs = Nothing
Response.write("<br><img src="&strPath&"/"&OutFileName&">")
'***** End Resize Images ******'
End IF
%>
</table>
</body>
</html>