NetTalk Central

Author Topic: Saving a Webcam image as a BLOB in a TPS file field  (Read 3574 times)

Richard I

  • Sr. Member
  • ****
  • Posts: 400
    • View Profile
    • Email
Saving a Webcam image as a BLOB in a TPS file field
« on: November 02, 2015, 02:31:52 AM »
I have followed through the NetTalk Webcam example and while I can create a picture from the webcam, I dont know how to save as a BLOB in a TPS file
The image appears to be saved in \uploads
I want to save it  in LOG:Photo which has been designated as a BLOB
I have included in the code OPEN and USEFile for the log file.
Thanks
 Richard
Nettalk 8.62

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Saving a Webcam image as a BLOB in a TPS file field
« Reply #1 on: November 03, 2015, 12:25:28 AM »
Hi Richard,

I would somewhat-strongly caution against storing images in a TPS Blob.You are going to create a world of pain for yourself at some point in the future.

TPS files (ie the file on disk) maxes out at 2 Gigs. So basically what you are doing with this design is creating a built-in time bomb that will go off at some point in the future. And the bad news is that when it happens _all_ your pics will be lost.

A _much_ better idea is to store the pics as disk files, one file per pic, and then have a TPS file which contains the filenames of these pics. You might think this is harder to manage now but
a) it scales
b) it's really fast to backup (since you only need to backup new pics, and the tps file.)

If you did want to add the image to a Blob, then you need to consider that the pic is uploaded part-way through the form, but the new record for the table is only created when the user clicks on "save". So the easiest is to allow it to save to disk, then move the disk image into the blob after the record is created. In other words in the PostInsert / PostUpdate routines.

In those routines the record has been created (or saved) so you can assign the blob there, and do an UPDATE on the record.

Cheers
Bruce


Richard I

  • Sr. Member
  • ****
  • Posts: 400
    • View Profile
    • Email
Re: Saving a Webcam image as a BLOB in a TPS file field
« Reply #2 on: November 03, 2015, 12:59:28 AM »
Thanks Bruce,
Cheers
Richard