Thumbnail | No component 3. Define thumbnail dimensions
This part of the code is the beholder, the benevolent. First, we need to specify the size range of the thumbnail display, such as: 300x260, the code can write this:
<%
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
pxwidth=300
Pxheight=formatnumber (300/pp,0)
Else
Pxwidth=pwidth
Pxheight=pheight
End If
Else
If pheight>=260 Then
pxheight=260
Pxwidth=formatnumber (260*pp,0)
Else
Pxwidth=pwidth
Pxheight=pheight
End If
End If
%>
Write the above code immediately after the second step. The code for the call is as follows:
border= "0" width=<%=pxwidth%>
Height=<%=pxheight%>>
As for the picture format can be used to get, picture size can be written
<%
Response.Write pxwidth& "X" &pxheight
%>
Picture size can be implemented with fso.getfilesize (filename), and the number of clicks can be implemented simply with the SQL statement, the specific code is no longer tired.
In this way, a component-free thumbnail program is written, it may be a bit copycat, but as long as we can master the method of trust is still a great improvement.