Denna kod (utan tvåan) använder jag för att få ut måtten på bilderna på min sida.
Jag skulle behöva hämta måttet två gånger.
Jag har bytt ut alla "dimar" och sattit en tvåa efteråt men jag får felmess:
Syntax error
/pictures.asp, line 275
Private Sub GetJPGSize(width2, height2, imagepath2)
--------^
Är det någon som förstår varför?
Dim width2, height2
Call GetJPGSize(width2, height2, Server.MapPath("/bilder/"&RS2("strFile")&""))
Private Sub GetJPGSize(width2, height2, imagepath2)
Dim oFile2 'As Scripting.File
Dim oStream2 'As Scripting.TextStream
Dim oFSO2 'As Scripting.FileSystemObject
Dim nDummy2 'As Byte
Set oFSO2 = CreateObject("Scripting.FileSystemObject")
Set oFile2 = oFSO.GetFile(imagepath2)
Set oStream2 = oFile.OpenAsTextStream
Set oFile2 = Nothing
Set oFSO2 = Nothing
Call oStream2.Read(2)
Do
Do
nDummy2 = Asc(oStream2.Read(1))
If nDummy2 = 255 Then
Exit Do
End If
Loop
Do
nDummy2 = Asc(oStream2.Read(1))
If nDummy2 <> 255 Then
Exit Do
End If
Loop
Select Case nDummy2
Case 192, 193, 194, 195, 197, 198, 199, 201, 202, 203, 205, 206, 207
Call oStream2.Read(3)
nDummy2 = Asc(oStream2.Read(1))
height2 = CLng(nDummy2 * 256)
nDummy2 = Asc(oStream2.Read(1))
height2 = height2 + CLng(nDummy2)
nDummy2 = Asc(oStream2.Read(1))
width2 = CLng(nDummy2 * 256)
nDummy2 = Asc(oStream2.Read(1))
width2 = width2 + CLng(nDummy2)
Exit Do
Case Else
nDummy2 = Asc(oStream2.Read(1))
width2 = CLng(nDummy2 * 256)
nDummy2 = Asc(oStream2.Read(1))
width2 = width2 + CLng(nDummy2)
Call oStream2.Read(width2 - 3)
End Select
Loop
oStream2.Close
Set oStream2 = Nothing
End Sub