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.