RE: Pictures in a table

Author: Paul H. Tarver

Posted: 2022-08-16 at 09:29:20

Unless you are referring to a SQL database blob field, I the 2Gb limit will

rear its ugly head very quickly in a Foxpro table when dealing with

pictures.

I have an application I built for a medical situation where users took

pictures of the patient for future reference and better customer service. My

solution was to allow the user click in the photo display area to add a

photo and then using getfile open a window for them to select the correct

photo. Once the original photo was selected, I generate a random file name

using SYS(2015) and copy the original file to a subfolder under the

application folder where all patient photos where stored with the randomly

generated filename. Finally, I stored the full path & filename of the

picture in a character field of 254 characters in the patient table.

By using the subfolder, I could insure the pathnames are never too long and

by using the randomly generated filename, if someone opens the storage

folder, they cannot easy connect any photo to a particular patient. Because

we copied the original file to our preferred location, I didn't have to

depend upon a user to a) name the file, or b) put it in specific location.

And, because I only store the path to the file, I get around the 2Gb limit

regardless of the size of the pictures. If I had it to do over again, I

might even consider doing a resize on the files during the copy process to

keep the files as small as possible. Within the application, when a user

pulls up a patient, if we find a path in the table and the file exists, we

display the photo (never the path or filename). If the user wants to upload

another pic, they just click on the photo and we provide a menu to them to

replace or delete the file. If a path has not been saved or a file does not

exist, we display a standard "Photo Not Available" graphic and if they click

on this, they can add a photo.

It is may not be a perfect solution, but it seems to work for this

situation.

Paul H. Tarver

Tarver Program Consultants, Inc.

-----Original Message-----

From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Jürgen

Wondzinski

Sent: Tuesday, August 16, 2022 4:07 AM

To: profoxtech@leafe.com

Subject: AW: Pictures in a table

Hi Ken,

There is now that funny thing called BLOB-Field. Your advice was relevant

for those dark times where we only had that General fieldtype. Now, the BLOB

is a Memofield like the General-Field, but it just stores Binary data

without any OLE-Information. You basically write the picture-file content

into that field, therefor you can always restore it to a real picture file

or just bind it to the PictureVal property of an ImageControl.

Create table Pictures (title C(50), content W)

Insert into Pictures (title, content) Values ("My Picture", GetPict("JPG") )

On your form you just add an image control and set

Pictureval = "Pictures.content")

-----Ursprüngliche Nachricht-----

Von: ProFox <profox-bounces@leafe.com> Im Auftrag von Ken Watkins

Gesendet: Montag, 15. August 2022 20:36

An: ProFox Email List <profox@leafe.com>

Betreff: Pictures in a table

Hi ProFoxers.

I haven't posted in a decade or two, but I'm still hanging around.

I am writing an app for my son to manage his business. He's a therapist and

routinely jots down notes on a small notepad during his client sessions. He

later adds typewritten notes into the client record but he also takes a

picture of his handwritten notes and copies/pastes it into the client

record. He's been using OneNote to accomplish this but he wants to move away

from that. So I started my app and it creates the client records and the

memo fields needed for the notes but I can't figure out what to do with the

picture.

Now I know that the standard advice is "do not store the picture in a

General field, store the path to the picture..." But I'm wondering if there

is a device or third party app that I could use to link the picture to the

client record. I even thought about him using a tablet with an electronic

pen to store his scribblings and somehow tie that into my Foxpro table.

Just looking for ideas on how to incorporate images with Foxpro records

elegantly.

Thanks.

Ken Watkins

--

This email has been checked for viruses by Avast antivirus software.

www.avast.com

--- StripMime Report -- processed MIME parts --- multipart/alternative

text/plain (text body -- kept)

text/html

---

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox

OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech

Searchable Archive: https://leafe.com/archives

This message: https://leafe.com/archives/byMID/0ba601d8b17c$9376ff20$ba64fd60$@tpcqpc.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2022 Paul H. Tarver