3. Define the thumbnail size
This part of the code is benevolent and wise. First, we need to specify the size range of the thumbnail display, for example, 300x260. The code can be written as follows:
<%
Dim pxwidth, pxheight
Dim pp // proportion
If pwidth = 0 or pwidth = "" then
Pxwidth = 0
Pxheight = 0
Else
Pp = formatnumber (pwidth/pheight, 2) // Aspect Ratio
End if
If pwidth> = pheight then
If pwidth> = 300 then
Ppxwidth = 300
Pxheight = formatnumber (300/pp, 0)
Else
Pxwidth = pwidth
Pxheight = pheight
End if
Else
If pheight> = 260 then
Pxheight = 1, 260
Pxwidth = formatnumber (260 * pp, 0)
Else
Pxwidth = pwidth
Pxheight = pheight
End if
End if
%>
Write down the above Code in the second step. The call time code is as follows:
border = "0" width = <% = pxwidth %>
Height = <% = pxheight %>
The image format can be used and the image size can be written
<%
Response. write pxwidth & "x" & pxheight
%>
The image size can be implemented using fso. getfilesize (filename), while the number of clicks can be implemented simply using SQL statements. The specific encoding will not be detailed.
In this way, a program with no components to generate thumbnails can be well written, which may be a bit tricky, but as long as you can master the method, I believe it will be greatly improved.
Article: webmaster Sky web site: http://www.z6688.com/
The above information is an integral part of the text. If you want to reprint this article, please keep the above information. Thank you!