[Top] generating thumbnails without components in Asp (3)

Source: Internet
Author: User
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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.