1. Picture shrinkage
<%
Set jpeg = Server.createObject (Persits.jpeg) call component
PATH = Server.MAppath (Images) & /Clock.jpg to be processed to handle the picture path
Jpeg.open path Open the picture
High and width are 1/2 of the original picture
Jpeg.width = jpeg.originalWidth / 2
Jpeg.height = jpeg.originalheight / 2
Save the picture
Jpeg.save server.mappath (images) & /Clock_small.jpg
%>
<IMG SRC = Images/CLOCK_SMALL.JPG> View the processing picture
Two, picture water marks
<%
Set jpeg = Server.createObject (Persits.jpeg)
Jpeg.open server.mappath (Images/Dodge_viper.jpg)
Start writing
Jpeg.canvas.font.color = & hff0000 'red color
Jpeg.canvas.font.family = Courier New font
JPEG.CANVAS.FONT.BOLD = whether true is bold
Jpeg.canvas.print 10, 10, Copyright (C) xyz, INC.
Printing coordinates x Printing coordinates Y need to print characters
The following is the frame processing of the picture
Jpeg.canvas.pen.color = & H000000 'Black color
Jpeg.canvas.pen.width = 2 brush width
Jpeg.canvas.brush.solid = whether false is bolded
Jpeg.canvas.bar 1, 1, jpeg.width, jpeg.height
Start x coordinate starting y coordinate input length input height
JPEG.SAVE Server.MAPPATH (Images/DODGE_VIPER_FRAMED.JPG)
%>
Three, security code
The principle of security code is almost the same as the addition of water marks. Many friends ask me to have a specific code technology. Here I write it out to share with you. I don't tell him most people. hehe.
<%
The function of generating a security code
Function Make_randomize (max_len, w_n) max_len generate length, W_n: 0 may include letters, 1: only numerals
randomize
for intcounter = 1 to max_len
Whatnext = int ((1-0+1)*RND+W_n)
if whatnext = 0 then
upper = 122
LOWER = 97
else
upper = 57
LOWER = 48
end if
StrNewpass = StrNewpass & Chr (incper-LOWER+1)*RND)+LOWER
next
Make_randomize = Strnewpass
end function
%>
Use pictures of a security code. Of course you have to prepare a background map in advance
<%random_num = Make_randomize (4,1) to generate a 4 -digit security code
Session (random_num) = Random_num why call session, and the security code without session is completely meaningless. hehe
Set jpeg = Server.createObject (Persits.jpeg) call component
Jpeg.open Server.mappath (Infos/Random_pic/Random_index.gif) Open the prepared picture
Jpeg.canvas.font.color = & H006699
Jpeg.canvas.font.family = Arial Black
Jpeg.canvas.font.bold = false
Jpeg.canvas.printtext 0, -2, random_num
jpeg.save server.mappath (infos/random_pic/random_index.bmp)
%> <IMG SRC = Infos/Random_PIC/RANDOM_INDEX.BMP BORDER = 0 Align = ABSMIDDLE>
Look at it yourself. hehe.
Fourth, picture cutting
People who have never understood ASPJPEG have always thought that they could not be cut with it.
In fact, there is such a method
CROP X1, Y1, X2, Y2
Cut the X coordinate of the upper left corner of the rectangular type, and the in the lower right corner of the y coordinate X
Let me make a demonstration below
Set jpeg = Server.createObject (Persits.jpeg)
jpeg.open server.mappath (/pic/1.gif)
jpeg.alt = 70
Jpeg.height = jpeg.originalheight*70 / jpeg.originawidth
JPEG.CROP 0,0,70,52 Starting cutting is actually removed the lower part of more than 52 pixels
jpeg.save server.mappath (/temp_pic/small_1.gif) save
How about it, it's very simple
Five, picture merger
We are to add logo pictures to dodge_viper.jpg picture
In fact, the method of merging picture can also be used to dynamic watermarks.
Set Photo = Server.createObject (Persits.jpeg)
PhotoPath = Server.mAppath (Images) & /Dodge_viper.jpg
Photo.open Photopath
Set logo = server.createObject (Persits.jpeg)
Logopath = server.mappath (images) & /Clock.jpg
Logo.open logopathly
Logo.width = 70
Logo.head = logo.width * logo.originalHeight / logo.originalWidth
Photo.DrawImage 0, 0, logo
Photo.sendbinary uses the output method of Sendbinary. Of course, you can also save the changing dodge_viper.jpg first, and then enter it. I personally don't like to use the Sendbinary method, it is easy to make mistakes when the network speed is slow. It is not good in terms of speed. hehe.
6. Database support
Not much to say here. In fact, it is the binary method. Everyone knows that the pictures can only be stored in the database. So the code is lazy.
Seven, more ways introduction
Canvas.line (left, TOP, RIGHT, BOTTOM))
Draw a straight line
Canvas.ellipse (left, TOP, RIGHT, BOTTOM)
Draw an ellipse
Canvas.circle (x, y, radius)
Draw a circle
Canvas.bar (left, Top, Right, Bottom)
Draw a rectangle, which is introduced on it
Canvas.font.ShadowColor
Text shadow color
Canvas.font.Shadowxoffset as long
Shadow X coordinate settings
Canvas.font.Shadowyoffset as long
Y coordinate setting
Canvas.font.bkmode as string
Text background