<%
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'::: BMP, GIF, JPG and PNG:::
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'::: :::
':: This function gets a specified number of bytes from::
'::: File, starting at the offset (base 1):::
'::: :::
'::: Passed::::
'::: flnm => filespec of file to read:::
'::: Offset => offset at which to start reading:::
'::: bytes => How many bytes to read::
'::: :::
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
function GetBytes (flnm, offset, bytes)
Dim objFSO
Dim objftemp
Dim objTextStream
Dim lngsize
On Error Resume Next
Set objFSO = CreateObject ("Scripting.FileSystemObject")
' We get the FileSize
Set objftemp = Objfso.getfile (FLNM)
Lngsize = Objftemp.size
Set objftemp = Nothing
fsoforreading = 1
Set objTextStream = objFSO.OpenTextFile (flnm, fsoforreading)
If offset > 0 Then
Strbuff = Objtextstream.read (offset-1)
End If
If bytes =-1 Then ' Get all!
GetBytes = Objtextstream.read (lngsize) ' ReadAll
Else
GetBytes = Objtextstream.read (bytes)
End If
Objtextstream.close
Set objTextStream = Nothing
Set objFSO = Nothing
End Function
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'::: :::
':: Functions to convert two bytes to a numeric value (long)::
'::: (both Little-endian and Big-endian):::