ciao ho fatto una ricerca, ma non l'ho provato.
qui usa il FileSystemObject
codice:
Gif files
<%
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile(Server.MapPath("sample.gif"))
ts.Skip(6)
s = ts.Read(4)
w = asc(mid(s,2,1))*256 + asc(mid(s,1,1))
h = asc(mid(s,4,1))*256 + asc(mid(s,3,1))
response.write(w)
response.write(" ")
response.write(h)
ts.close
set ts = Nothing
set fso = Nothing
%>
BMP PNG
<%
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile(Server.MapPath("sample.bmp"))
ts.Skip(18)
s = ts.Read(6)
w = asc(mid(s,2,1))*256 + asc(mid(s,1,1))
h = asc(mid(s,6,1))*256 + asc(mid(s,5,1))
response.write(w)
response.write(" ")
response.write(h)
ts.close
set ts = Nothing
set fso = Nothing
%>
JPEG
<%
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile(Server.MapPath("sample.jpg"))
ts.Skip(2)
do
do
s = ts.Read(1)
if asc(s) <> 255 then exit do
loop
if asc(s) < 192 or 195 < asc(s) then
s = ts.Read(2)
l = CLng(asc(mid(s,1,1)))*256 + asc(mid(s,2,1))
ts.Skip(l - 2)
else
exit do
end if
loop
s = ts.Read(7)
w = asc(mid(s,6,1))*256 + asc(mid(s,7,1))
h = asc(mid(s,4,1))*256 + asc(mid(s,5,1))
response.write(w)
response.write(" ")
response.write(h)
ts.close
set ts = Nothing
set fso = Nothing
%>