ASP no component generation thumbnails (2)

Source: Internet
Author: User
Thumbnails | No components now we first design a showimg.asp page to display thumbnails and related information. The specific design is as follows:

Image:

Picture format:

Picture size:

Picture size:

Number of clicks:

Below, we get the absolute path of the picture. The code is as follows:
<%
'/////gets showimg.asp's absolute path/////
Dim Curfile
Curfile=server.mappath (Request.ServerVariables ("Path_info"))
Dim Curfilename,filename

'/////picture relative path (stored in the database)
Cufilename=rs ("Imgurl")

'/////because showimg.asp and images are in the same directory, so we use InStrRev to get the images path/////
Filename=left (Curfile,instrrev (curfile, "\")) &cufilename

'/////set up a GPS class entity/////
Dim getpicsize
Set getpicsize=new GPS
Set fs=server.createobject ("Scripting.FileSystemObject")

'/////get Picture type/////
Dim Picsuffixname
Picsuffixname=fs. Getextensionname (filename)
Dim PD '//picture Dimension
Dim Pwidth,pheight
Select Case Picsuffixname
Case "GIF", "BMP", "JPG", "PNG":

'/////calls the GetImageSize function in the GPS generic class to get the picture size/////
Pd=getpicsize.getimagesize (filename)
PWIDTH=PD (1) '//Get picture width
PHEIGHT=PD (2) '//Get picture height
Case "SWF"
Pd=getpicsize.getimagesize (filename)
PWIDTH=PD (1) '//Get flash width
PHEIGHT=PD (2) '//Get flash Height
Case Else
End Select
Set fs=nothing
Set getpicsize=nothing
%>

Copy the above code to the top on the OK!

Of course, some people will say, get the path does not need to use path_info, directly with Server.MapPath () It is OK, oh, radish greens, the main is that I use path_info can achieve some of the functions of FSO with Server.MapPath () Not done, so keep using this.




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.