We're building a brand new version of the site, and we'd love to hear your ideas
Members
Technology Zones
IBM Learning Center
Articles
Hosted By
Info
|
[1971] Retrieving Remote Image Properties in ASP
Last post 09-07-2005 2:31 PM by Youk88. 27 replies.
-
01-01-1999 12:00 AM
|
|
Advertisement
|
|
-
-
cascoly


- Joined on 11-21-2002

- Points 15
|
Excellent code -- i'd been struggling with the original code and had a problem opening and reading the image files -- i swapped in this code and my routines ran the first time.
My travel pages contain hundreds of images and i need a quick way to add new images and display them across many different pages. so i wrote a routine that lets the user decide whether to display in thumbnail, caption only, or full size. until now, i didnt have an easy way of knowing the format, so i had to encode whether the image was horizontal or vertical -- now it works as it should, and will allow me to scale images in all fomats, too.
to see a sample of this in action:
http://cascoly.com/trav/turkey/Konya.asp
thanks
steve
|
|
-
-
-
-
-
-
-
-
salmo


- Joined on 06-23-2003

- Points 10
|
Hey y'all, I've just astounded myself by being able to use this peice o' code, so I thought I'd share it with you.
The code below calls the function and print the results.
Salmo xxx
<%
dim theURL, theWidth, theHeight, theDepth, theFlType, blnImageStuff
theURL = "http://www.notongues.com/flyer.jpg"
theWidth = 0
theHeight = 0
theDepth = 0
theFlType = ""
blnImageStuff = getSize(theURL, theWidth, theHeight, theDepth, theFlType)
if blnImageStuff then
response.Write(theWidth & "<br>")
response.Write(theHeight & "<br>")
response.Write(theDepth & "<br>")
response.Write(theFlType & "<br>")
else
response.Write("Hmm, that didn't seem to work...")
end if
%>
|
|
-
-
aprida


- Joined on 05-22-2003

- Points 30
|
Can I change the URL with path?
Thanks for the code
I've been waiting it for so long. It takes 1 month to get the reply.
Can I change the URL with the path such as /image ??
I find it becomes very slow for the script to be run if I use the complete URL like http://...
I place the image file in one folder inside the folder where I put the script. And probably it will be faster if I change URL with the path.
If I can change it, what is the command?
|
|
-
-
-
darioj


- Joined on 10-02-2003

- Points 10
|
Hi,
I needed a way to find width and height of an image and came up with this script. I use loadpicture vbscript function to get image dimensions. The OS will return dimensions in metric scale (cm/1000). Windows screen res. is 96 dots per inch. 1 inch is 2.54 cm.
2.54/96*1000 = 26.4583
I know that the script above scales images but if you just need image dimensions this works fine. You can also get the type, handle, and palette of the image. Props are on msdn: click here
Code:
<%
dim iWidth, iHeight, iType
sub ImgDimension(img)
dim myImg, fs
Set fs= CreateObject("Scripting.FileSystemObject")
if not fs.fileExists(img) then exit sub
set myImg = loadpicture(img)
iWidth = round(myImg.width / 26.4583)
iHeight = round(myImg.height / 26.4583)
iType = myImg.Type
select case iType
case 0
iType = "None"
case 1
iType = "Bitmap"
case 2
iType = "Metafile"
case 3
iType = "Icon"
case 4
iType = "Win32-enhanced metafile"
end select
set myImg = nothing
end sub
' so if you whant to test it in asp just give the path to your image
ImgDimension(Server.MapPath("../.") & "\images\uc.gif")
response.write("Dimensions: " & iWidth & " x " & iHeight & "<br>")
response.write("Image Type: " & iType & "<br>")
%>
|
|
-
-
-
|
Search
Code Samples
New Members
|