Hi!

Aus einem frueheren Posting:

<schnipp>

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.

</schnipp>

Am Mittwoch den, 13. Februar 2002, um 17:33, schrieb J�rg Schwalenberg:

Hallo Leute,

hat jemand von Euch eine Idee, wie ich die Breite und H�he eines Bildes
automatisch auslesen kann ?

Vielen Dank im voraus !!

J�rg Schwalenberg
_______________________________
Extensions and Basics for Macromedia
"Dreamweaver Ultradev"
..............................................................
www.ultradevextensions.de
www.udex.de
[EMAIL PROTECTED]
_______________________________


| [aspdecoffeehouse] als [EMAIL PROTECTED] subscribed
| http://www.aspgerman.com/archiv/aspdecoffeehouse/ = Listenarchiv
| Sie k�nnen sich unter folgender URL an- und abmelden:
| http://www.aspgerman.com/aspgerman/listen/anmelden/aspdecoffeehouse.asp



| [aspdecoffeehouse] als [EMAIL PROTECTED] subscribed
| http://www.aspgerman.com/archiv/aspdecoffeehouse/ = Listenarchiv
| Sie k�nnen sich unter folgender URL an- und abmelden:
| http://www.aspgerman.com/aspgerman/listen/anmelden/aspdecoffeehouse.asp


Am Donnerstag den, 27. Juni 2002, um 13:58, schrieb Jens:

> wie kann ich von einem geladenen bild die breite und hoehe bestimmen, ohne
> eine asp-komponente zu gebrauchen?
>
>
> danke
>
> jens
>
>
> | [aspdecoffeehouse] als [EMAIL PROTECTED] subscribed
> | http://www.aspgerman.com/archiv/aspdecoffeehouse/ = Listenarchiv
> | Sie k�nnen sich unter folgender URL an- und abmelden:
> | http://www.aspgerman.com/aspgerman/listen/anmelden/aspdecoffeehouse.asp
>


| [aspdecoffeehouse] als [email protected] subscribed
| http://www.aspgerman.com/archiv/aspdecoffeehouse/ = Listenarchiv
| Sie k�nnen sich unter folgender URL an- und abmelden:
| http://www.aspgerman.com/aspgerman/listen/anmelden/aspdecoffeehouse.asp

Antwort per Email an