Veröffentlicht 4. August 200322 j Hi an alle, Ich habe mal eine frage, kann man in oder mit ASP die Höhe und Breite von ein Bild-Datei ermitteln? Und wenn ja, wie funktioniert das? Ich bedanke mich schon mal in vorraus für alle Antworten. MFG Atlantis
5. August 200322 j Moing! Also man kann die Größe eines Bildes schon in ASP ermitteln... Ich schau mal nach, wie genau das geht..... Grundprinzip: Im Scripting.FileSystemObject die Datei binär auslesen und "mitzählen", dann umrechnen in Pixel..... Da gibt bestimmt einen link, wo das ganze gecoded ist.. momentchen..:beagolisc
5. August 200322 j <% Option Explicit Dim objFS Dim objImageFile Dim strStream Dim strWidth Dim strHeight Dim strImage Dim strFileSize strImage = "../hier_steht_mein_Bildchen.gif" Set objFS = CreateObject( _ "Scripting.FileSystemObject") Set objImageFile = objFS.GetFile( _ Server.MapPath(strImage)) strFileSize = CStr(objImageFile.Size) Set objImageFile = Nothing Set objImageFile = objFS.OpenTextFile( _ Server.MapPath(strImage), 1) strStream = objImageFile.Read(11) objImageFile.Close Set objImageFile = Nothing Set objFS = Nothing ' -------------------------------------------------------------- ' Umwandeln der binären Informationen in ' verwertbare Daten ' ' Die Breite befindet sich in den Bytes 7 und 8 ' Die Höhe befindet sich in den Bytes 9 und 10 ' -------------------------------------------------------------- strWidth = CStr(Asc(Mid(strStream, 7, 1)) + _ Asc(Mid(strStream, 8, 1)) * 256) strHeight = CStr(Asc(Mid(strStream, 9, 1)) + _ Asc(Mid(strStream, 10, 1)) * 256) %> Dann klappts auch mitm Nachbarn....
Archiv
Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.