EXIF Information ASP version with JPEG files (4)

Source: Internet
Author: User
Function Openjpgfile (FileName)

Dim Ascii, Lasthex, Currenthex, Sosfound
Dim FSO, File, I

If Not FileName = "" Then

If InStr (1, FileName, ": \") = 0 Then
filename = Server.MapPath (filename)
End If

Set FSO = Server.CreateObject ("Scripting.FileSystemObject")
If FSO. FileExists (FileName) Then
Set File = FSO. OpenTextFile (FileName, ForReading, False, Tristatefalse)
i = 0
While not file.atendofstream and Sosfound = False

Ascii = ASC (File.read (1))
Lasthex = Currenthex
Currenthex = Right ("0" & Hex (ASCII), 2)
If Lasthex & currenthex = "FFDA" or I > 100000 then
Sosfound = True
End If
Exiftemp (i) = Currenthex
i = i + 1
ReDim Preserve exiftemp (i)
Wend
File.close

Set File = Nothing
Else
Response.Write ("File does not exist")
End If
Set FSO = Nothing

End If
End Function

Sub getdirectoryentries (Offset)

Dim no_of_entries
Dim upper_ifddirectory
Dim newdimensions
Dim PROCESSED_EXIFSUBIFD
Dim bytespercomponent
Dim Offset_to_makernote
Dim I, J, K

Todo
If Isintel Then
No_of_entries = _
Hextodec (Exiftemp (Offset + 1)) * 256 + _
Hextodec (exiftemp (Offset + 0))
Else
No_of_entries = _
Hextodec (exiftemp (Offset + 0)) * 256 + _
Hextodec (Exiftemp (Offset + 1))
End If

On Error Resume Next
Upper_ifddirectory = UBound (ifddirectory)
On Error GoTo 0

Newdimensions = upper_ifddirectory + no_of_entries

ReDim Preserve ifddirectory (newdimensions)

For i = 1 to No_of_entries
K = upper_ifddirectory + i-1

Ifddirectory (k) = Array (null,null,null,null,null,null,null)
' With ifddirectory (upper_ifddirectory + i)

If Isintel Then
Ifddirectory (k) (ifd_idx_tag_no) = _
Exiftemp (Offset + 2) + ((i-1) * 1) & _
Exiftemp (Offset + 2) + ((i-1) * 12) + 0)
' Hextodec exiftemp ((Offset + 2) + ((i-1) * 12) + 1) * 256 + _
' Hextodec (exiftemp (Offset + 2) + ((i-1) * 12) + 0)

Ifddirectory (k) (Ifd_idx_data_format) = _
Hextodec (Exiftemp (Offset + 2) + ((i-1) * 12) + 3) * 256 + _
Hextodec (Exiftemp (Offset + 2) + ((i-1) * 12) + 2)

Ifddirectory (k) (ifd_idx_components) = _
Hextodec (Exiftemp (Offset + 2) + ((i-1) * 12) + 7) * 256 * 256 * 256 + _
Hextodec (Exiftemp (Offset + 2) + ((i-1) * 12) + 6) * 256 * 256 + _
Hextodec (Exiftemp (Offset + 2) + ((i-1) * 12) + 5) * 256 + _
Hextodec (Exiftemp (Offset + 2) + ((i-1) * 12) + 4)

Select case Ifddirectory (k) (Ifd_idx_data_format)

Case M_byte, M_sbyte
Bytespercomponent = 1
If Ifddirectory (k) (ifd_idx_components) * Bytespercomponent <= 4 Then
Ifddirectory (k) (Ifd_idx_value) = _
Exiftemp (Offset + 2) + ((i-1) * one) & _
Exiftemp (Offset + 2) + ((i-1) * +) & _
Exiftemp (Offset + 2) + ((i-1) * 9) & _
Exiftemp (Offset + 2) + ((i-1) * 12) + 8)
Else
Ifddirectory (k) (Ifd_idx_offsettovalue) = _
Hextodec (Exiftemp (Offset + 2) + ((i-1) * 12) + 11) * 256 * 256 * 256 + _
Hextodec (Exiftemp (Offset + 2) + ((i-1) * 12) + 10) * 256 * 256 + _
Hextodec (Exiftemp (Offset + 2) + ((i-1) * 12) + 9) * 256 + _
Hextodec (Exiftemp (Offset + 2) + ((i-1) * 12) + 8)
Fo



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.