resize_upload.asp

来自「aspupload」· ASP 代码 · 共 44 行

ASP
44
字号
<!-- AspUpload Code samples: resize_upload.asp -->
<!-- Invoked by resize.asp -->
<!-- Copyright (c) 2001 Persits Software, Inc. -->
<!-- http://www.persits.com -->

<HTML>
<BODY>

<%

Set Upload = Server.CreateObject("Persits.Upload")

' Use AspJpeg to resize image
Set Jpeg = Server.CreateObject("Persits.Jpeg")

' Capture and save uploaded image to the same directory as script
Upload.Save Server.MapPath(".")

For Each File in Upload.Files
	If File.ImageType <> "JPG" Then
		Response.Write "This is now a JPGE image."
		File.Delete
		Response.End
	End If

	Jpeg.Open File.Path

	Scale = Upload.Form("Scale")
	Jpeg.Width = Jpeg.OriginalWidth * Scale / 100
	Jpeg.Height = Jpeg.OriginalHeight * Scale / 100

	Response.Write Jpeg.OriginalHeight & "-" & Jpeg.Height

	Jpeg.Save Server.MapPath(".") & "\small_" & File.FileName
%>
	<IMG SRC="<% = File.FileName %>"><BR>
	<IMG SRC="<% = "small_" & File.FileName %>"><P>
<%
Next
%>

</BODY>
</HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?