ASP no component to generate thumbnails [2]

Source: Internet
Author: User
Now we first design a showimg. ASP page to display thumbnails and related information. The specific design is as follows:

Image:

Image Format:

Image Size:

Image Size:

Clicks:

Next, we get the absolute path of the image. The Code is as follows:
<%
'// Obtain the absolute path of showimg. asp /////
Dim curfile
Curfile = server. mappath (request. servervariables ("path_info "))
Dim curfilename, filename

'// Relative path of the image (stored in the database)
Cufilename = RS ("imgurl ")

'// Because showimg. asp is in the same directory as images, we can use javasrev to obtain the images path /////
Filename = left (curfile, curfile Rev (curfile, "/") & cufilename

'// Create a GPS object /////
Dim getpicsize
Set getpicsize = new GPS
Set FS = server. Createobject ("scripting. FileSystemObject ")

'// Obtain the image type /////
Dim picsuffixname
Picsuffixname = FS. getextensionname (filename)
Dim PD '// picture dimension
Dim pwidth, pheight
Select case picsuffixname
Case "GIF", "BMP", "jpg", "PNG ":

'// Call the getimagesize function in the general GPS class to obtain the image size /////
Pd = getpicsize. getimagesize (filename)
Pwidth = Pd (1) '// obtain the Image Width
Pheight = Pd (2) '// get the Image Height
Case "SWF"
Pd = getpicsize. getimagesize (filename)
Pwidth = Pd (1) '// obtain the flash width
Pheight = Pd (2) '// obtain the flash height
Case else
End select
Set FS = nothing
Set getpicsize = nothing
%>

Copy the above Code to the <body> above and it will be OK!

Of course, some people may say that path_info is not required to obtain the path, but server is used directly. mappath () is not enough. Haha, radish vegetables have their own love, mainly because I use path_info to implement some FSO functions and use server. mappath () is not fixed, so this is always used.

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.