Results 1 to 3 of 3

Thread: Binary writing of JPG from access problem..

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Posts
    424

    Binary writing of JPG from access problem..

    I have bmps, gifs, and jpgs stored in my access 97 database. I have no problems binary writing bitmaps and gifs because I know the header point that access adds to the ole field...BM and GIF89 respectively but I can't find the jpg access header in the ole field... can anyone tell me what it is? Here is a sample of the code I'm using to binary write the correct information. You'll see what I mean by the access header..
    VB Code:
    1. ExportFile Me.RecordsetClone.Fields("PictureType")
    2. Dim lngFileSize As Long, lngOffset As Long
    3. Dim strChunk As String, strBuild As String, intPos As Integer
    4.  
    5. lngOffset = 0
    6. lngFileSize = 0
    7. lngFileSize = Me.RecordsetClone.Fields("picture").FieldSize
    8.  
    9. Do While lngOffset < lngFileSize
    10.      strChunk = Me.RecordsetClone.Fields("picture").GetChunk(lngOffset, 1024)
    11.      strBuild = strBuild & strChunk
    12.      lngOffset = lngOffset + 1024
    13. Loop
    14. strBuild = StrConv(strBuild, vbUnicode)
    15. intPos = InStr(strBuild, "BM")  '<--- I need the header for a jpg file
    16.  
    17. If intPos > 0 Then
    18.      strBuild = right(strBuild, Len(strBuild) - intPos + 1)
    19. End If
    20.  
    21. Open strFilename For Binary As #1
    22. Put #1, , strBuild
    23. Close #1

  2. #2
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    JFIF i believe. you really only need to extract the first 10 bytes of the file.
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Posts
    424
    Nevermind.. I figured it out.. there is no header code for a jpg.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width