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.