Das war vor ein paar wochen in der liste:

-----Urspr�ngliche Nachricht-----
Von: Joachim van de Bruck [mailto:[EMAIL PROTECTED]]
Gesendet: Freitag, 5. Oktober 2001 12:12
An: ActiveServerPages German
Betreff: [aspgerman] AW: [aspgerman] AW: [aspgerman] Gr��e eines Bildes


Hallo!

Wenn Du das JPG- und GIF-Format kennst, kannst Du auf die Grafikdatei
mit dem FSO zugreifen und die entsprechenden Bytes auslesen, die immer
an der gleichen Stelle im Header stehen.

Ich habe daf�r folgende "inc.file.asp":

<%
function fileGetBytes(pFile, pOffset, pBytes)
        dim fso, flo, ftf
        dim maxSize, theBuff
        on error resume next
        set fso = CreateObject("Scripting.FileSystemObject")
        set flo = fso.GetFile(pFile)
        maxSize = flo.Size
        set flo = nothing
        set ftf = fso.OpenTextFile(pFile, 1)
        if pOffset > 0 then theBuff = ftf.Read(pOffset - 1)
        if pBytes  > 0 then fileGetBytes = ftf.Read(pBytes)
        else fileGetBytes = ftf.Read(maxSize)
        end if
        ftf.Close: set ftf = nothing: set fso = nothing
end function

function fileConvert(pString) fileConvert = clng(asc(left(pString, 1)) +
asc(mid(pString, 2, 1)) * 256)
end function

function fileConvert2(pString) fileConvert2 = clng(asc(mid(pString, 2,
1)) + asc(left(pString, 1)) * 256)
end function

function fileGfxSpex(pFile, pWidth, pHeight, pDepth, pType)
        pType   = "(unknown)" fileGfxSpex = False
        dim tPNG: tPNG = chr(137) & chr(80) & chr(78)
        dim tGIF: tGIF = "GIF"
        dim gfxType: gfxType = fileGetBytes(pFile, 0, 3)
        if gfxType = tGIF then
                pType   = "GIF"
                pWidth  = fileConvert(GetBytes(pFile, 7, 2))
                pHeight = fileConvert(GetBytes(pFile, 9, 2))
                pDepth  = 2 ^ ((asc(GetBytes(pFile, 11, 1)) and 7) + 1)
fileGfxSpex = True
        elseif gfxType = tPNG then
                pType   = "PNG"
                pWidth  = fileConvert2(GetBytes(pFile, 19, 2))
                pHeight = fileConvert2(GetBytes(pFile, 23, 2))
                pDepth  = fileGetBytes(pFile, 25, 2)
                select case asc(right(pDepth,1))
                        case 0: pDepth = 2 ^ (asc(left(pDepth, 1)))    :
fileGfxSpex = True
                        case 2: pDepth = 2 ^ (asc(left(pDepth, 1)) * 3):
fileGfxSpex = True
                        case 3: pDepth = 2 ^ (asc(left(pDepth, 1)))    :
fileGfxSpex = True
                        case 4: pDepth = 2 ^ (asc(left(pDepth, 1)) * 2):
fileGfxSpex = True
                        case 6: pDepth = 2 ^ (asc(left(pDepth, 1)) * 4):
fileGfxSpex = True
                        case else: pDepth = -1
                end select
        else
                dim strBuff, lngSize, flgFound, strTarget, lngPos,
ExitLoop, lngMarkerSize
                strBuff = fileGetBytes(pFile, 0, -1)        ' Get all
bytes from file
                lngSize = len(strBuff)
                flgFound = 0
                strTarget = chr(255) & chr(216) & chr(255)
                flgFound = instr(strBuff, strTarget)
      if flgFound = 0 then
         exit function
      end if
      pType = "JPG"
      lngPos = flgFound + 2
      ExitLoop = false
      do while ExitLoop = False and lngPos < lngSize
         do while asc(mid(strBuff, lngPos, 1)) = 255 and lngPos <
lngSize
            lngPos = lngPos + 1
         loop
         if asc(mid(strBuff, lngPos, 1)) < 192 or asc(mid(strBuff,
lngPos, 1)) > 195 then
            lngMarkerSize = fileConvert2(mid(strBuff, lngPos + 1, 2))
            lngPos = lngPos + lngMarkerSize  + 1
         else
            ExitLoop = True
         end if
      loop
      if ExitLoop = False then
         pWidth = -1
         pHeight = -1
         pDepth = -1
      else
         pHeight = fileConvert2(mid(strBuff, lngPos + 4, 2))
         pWidth = fileConvert2(mid(strBuff, lngPos + 6, 2))
         pDepth = 2 ^ (asc(mid(strBuff, lngPos + 8, 1)) * 8) fileGfxSpex
= True
      end if
        end if
end function
%>

Die Funktion "fileGfxSpex" liefert den Typ, die Breite und H�he und die
Farbtiefe einer GIF-, JPG- oder PNG-Datei, wobai auch unterschiedliche
JPG-Formate ber�cksichtigt werden.

Freundliche Gr��e
Joachim van de Bruck

PS: Hoffentlich kannst Du den Code trptz Zeilenumbr�che problemlos
�bertragen.

-----Urspr�ngliche Nachricht-----
Von: Thomas Bandt [mailto:[EMAIL PROTECTED]]
Gesendet: Donnerstag, 22. November 2001 11:55
An: ASP Diskussionsliste fuer Anfaenger
Betreff: [aspdebeginners] Bildgr��e


sagt mal gibt es ne m�glichkeit mit asp die gr��e
eines jpegs auszulesen???


| Oft Gefragtes: http://www.aspgerman.com/aspgerman/faq/
| [aspdebeginners] als [EMAIL PROTECTED] subscribed
| http://www.aspgerman.com/archiv/aspdebeginners/ = Listenarchiv
| Sie knnen sich unter folgender URL an- und abmelden:
| http://www.aspgerman.com/aspgerman/listen/anmelden/aspdebeginners.asp

| Oft Gefragtes: http://www.aspgerman.com/aspgerman/faq/
| [aspdebeginners] als [email protected] subscribed
| http://www.aspgerman.com/archiv/aspdebeginners/ = Listenarchiv
| Sie knnen sich unter folgender URL an- und abmelden:
| http://www.aspgerman.com/aspgerman/listen/anmelden/aspdebeginners.asp

Antwort per Email an