aspjpeg 打水印

1.asp

==

<%
 ' create a thumbnail from an image stored in the database
 ' This code sample requires AspJpeg 1.2+

 ' Using ADO, open database with an image blob
 strConnect = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("../db/aspjpeg.mdb")

 Set rs = Server.CreateObject("adodb.recordset")
 SQL = "select image_blob from images2 where id = " & Request("id")
 rs.Open SQL, strConnect, 1, 3
 

 Set Jpeg = Server.CreateObject("Persits.Jpeg")
 
 LocalFile="d:/w.jpg"
Dim Jpeg
Set Jpeg = Server.CreateObject("Persits.Jpeg")
If Err.Number=-2147221005 then
Response.write "没有这个组件,请安装!"'检查是否安装AspJpeg组件
Response.End()
End If
Jpeg.Open (LocalFile)'打开图片
If err.number then
Response.write"打开图片失败,请检查路径!"
Response.End()
End if
Dim TempA '原始图片的二进制数据
TempA=Jpeg.Binary'将原始数据赋给TempA

 ' Open image directly from recordset
 Jpeg.OpenBinary TempA

 ' resize
 jpeg.Width = Request("Width")

 ' Set new height, preserve original width/height ratio
 jpeg.Height = jpeg.OriginalHeight * jpeg.Width / jpeg.OriginalWidth

 ' apply sharpening
 Jpeg.Sharpen 1, 110


 Jpeg.SendBinary

 rs.Close
%>

==

2.asp ==输出JPG

<HTML>
<HEAD>
<TITLE>AspJpeg Manual Chapter 2 - Thumbnails from the Database</TITLE>
</HEAD>
<BODY>
<h2>Thumbnails directly from a database-stored image</h2>
<%
For Width = 100 to 400 Step 100
%>

<IMG SRC="2.asp?width=<% = Width %>&id=1"><P>

<%
Next
%>

</BODY>
</HTML>

===

原文地址:https://www.cnblogs.com/y0umer/p/3839436.html