My ASP trip-no component generation thumbnails

Source: Internet
Author: User
There are many ASP components that generate thumbnails on the web. If your virtual space does not support registering new components, you may feel your site is a bit tarnished. The heart is clear, combined with online resources to write a component-free thumbnail program, for reference only.
Let's look at the basic section first. First, we know that displaying the picture in the page is the following code:
SRC is the picture path, border control the edge of the picture, width is the length of the picture, height is the picture. The production of thumbnails is actually scaled on the original size. But generally in order to minimize distortion, we will scale proportionally. Thus, getting the long and wide dimensions of a picture is the key to generating thumbnails.
The following steps are to write a component-free build thumbnail:
1. No component to get picture size
Just learned the ASP before soon saw an article using ASCII code to achieve the size of the picture without components. Later tried, found in the acquisition of JPG image size is always not correct display, check the Internet, there are many sites reproduced this program, but no one pointed out the defects of this program, but also not to solve the defects of the method. Then Google again, and finally found an introduction to the use of ADODB.stream to get picture size of the article, according to its introduction method, modify the code inside tried to try, the effect is really good, now take it out to share with you:
Using ADODB.stream to get the general class of picture size
<%
'////////////gps:get picture Size//////////////
'//////////////use ADODB.stream to get picture size//////////////
'/////////cited by Leon (Heart fine) August 11, 2005//////////
Class GPS
Dim ASO
Private Sub Class_Initialize
Set aso=createobject ("ADODB.stream")
Aso. Mode=3
Aso. Type=1
Aso. Open
End Sub
Private Sub Class_Terminate
Set aso=nothing
End Sub
Private Function bin2str (Bin)
Dim I, Str
For I=1 to LenB (Bin)
CLOW=MIDB (bin,i,1)
If AscB (Clow) <128 Then
str = str & CHR (ASCB (Clow))
Else
I=i+1
If I <= LenB (Bin) then str = str & CHR (ASCW (MidB (bin,i,1) &clow))
End If
Next
Bin2str = Str
End Function
Private Function num2str (num,base,lens)
' GPS (2005-8-11)
Dim ret

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.