Forum Moderators: open
ie. I can upload 1.jpg to my server, this now sits at www.domain.com/images/1.jpg
Now I can display this on the page using <img src="/images/1.jpg" />
What I would like to do is create 2 variables that have the height and width in pixels, ie
<%
xwidth = 200
yheight = 200
%>
But i just can't work out how to get the image specs.
Using the following function I could determine the width and height
dim iWidth, iHeight
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)
set myImg = nothing
end sub
then if i put the image path into
ImgDimension(Server.MapPath("/images/image.jpg"))
You can use iWidth and iHeight to get the width and height