Author Topic: Displaying Thumbnails in browser.  (Read 3631 times)

0 Members and 1 Guest are viewing this topic.

Charlie Markwick

  • Member
  • **
  • Posts: 23
    • View Profile
Displaying Thumbnails in browser.
« on: 2014-10-28 20:13:34 »
I'm trying to display the embedded thumbnail in a browser. The thumbnails are being stored as JPEG (Lossy). I'm using the PHP code:-

print ' ';

... however this doesn't worked and I'm stumped as to how to proceed. Does anyone have any ideas?

Daan van Rooijen

  • Administrator
  • Sr. Member
  • *****
  • Posts: 938
    • View Profile
Displaying Thumbnails in browser.
« Reply #1 on: 2014-10-28 22:25:57 »
I can't comment on the source code as such (I don't speak PHP), but to my knowledge the thumbnail is stored as a straight binary stream without any base64 encoding (in other words, if you would export the data from the blob to a file, it would be a regular .jpg file like any other).

I found some PHP source code from a similar project that someone built around a PostgreSQL ThumbsPlus v6 database. If you'd like to see it, send me an e-mail and I'll forward it to you.
I'm volunteering as a moderator - I do not work for Cerious Software, Inc.

Charlie Markwick

  • Member
  • **
  • Posts: 23
    • View Profile
Displaying Thumbnails in browser.
« Reply #2 on: 2014-10-29 03:27:47 »
Please Daan. I'll try without decoding too.

Charlie Markwick

  • Member
  • **
  • Posts: 23
    • View Profile
Displaying Thumbnails in browser.
« Reply #3 on: 2014-10-29 14:19:54 »
It seems that whatever I try I can't get the thumbnails to display. The BLOB does not appear to be a raw JPEG. If I change the database format and select to store the thumbnails in files then they do get saved as JPEGS. However I can't see any way of identifying the path to the external file, there must be a way. This is a show stopper, if I can't find a solution to it then I'll have to abandon using T+ for my local school. I seem to remember there used to be a Web Client product that allowed access to the images. Can't find it now though.

Daan van Rooijen

  • Administrator
  • Sr. Member
  • *****
  • Posts: 938
    • View Profile
Displaying Thumbnails in browser.
« Reply #4 on: 2014-10-29 18:44:33 »
The web client never reached full maturity and is no longer sold or supported.

Are you sure that the BLOB data isn't a full .JPG? I found some ADO code (which I don't speak either) that retrieves thumbnails and saves them as .jpg and it doesn't seem to do anything to the data. I'll post it in a reply.
I'm volunteering as a moderator - I do not work for Cerious Software, Inc.

Daan van Rooijen

  • Administrator
  • Sr. Member
  • *****
  • Posts: 938
    • View Profile
ADO code found in old newsgroups
« Reply #5 on: 2014-10-29 18:46:05 »
Paul,

This worked in a Microsoft Access Project file which uses ADO. You should be
able to reshape it to your needs. Substitute 'CurrentProject.Connection'
with your own connection object. The only restriction is that the the
thumbnail in TP needs to be in JPEG format.

Hope this helps

Allan
============================================
Function WriteJPG(idThumb As Long, Destination As String)
    Dim objRecordset As New ADODB.recordset
    Dim stream As New ADODB.stream

    With objRecordset
        .Open "thumbnail", CurrentProject.Connection, adOpenStatic,
adLockReadOnly, adCmdTableDirect
        .MoveFirst
        .Find "idThumb = " & CStr(idThumb)

        If .EOF Then GoTo Finish

    End With

    With stream
        .Type = 1 'adTypeBinary
        .Mode = 3 'adModeReadWrite
        .Open
        .Write objRecordset("Thumbnail")
        .SaveToFile Destination, 2 ' adSaveCreateOverwrite
        .Close
    End With

Finish:

    Set stream = Nothing
    objRecordset.Close
    Set objRecordset = Nothing

End Function
============================================
I'm volunteering as a moderator - I do not work for Cerious Software, Inc.

Charlie Markwick

  • Member
  • **
  • Posts: 23
    • View Profile
ADO code found in old newsgroups
« Reply #6 on: 2014-10-30 03:46:58 »
I can save a thumbnail into the DB as a JPEG and retrieve it OK. The problem is retrieving the ones that T+ has made.