Add Photos… in a second Table or DB ?

Hi,

in a demonstration (not the production application) application, I want to add some Photos. *

But: I do not want to fork the project,
I want to be able to trash this additionas fast and easy as possible,

When I wrote the Conversation title, I issues two ideas: add another Table in the same SQLite file or create a special Table for the images. The idea is to add a simple test: if the Table / .sqlite does not exist do nothing (else, load the photo and display it if one exists)?

Ideas, Clues ?

  • I already changed the persons First Name, Last Name and Spouse Name after duplicating the production DB file. SInce this does not impact the code, it was long and painful, but have no impact on the application nor on the development project.

The idea is to be able to display the poduct to non authorized people / place the application and a DB file (SQLite) in my cloud.

you can do one of a few things.

  1. add a field to the existing table and put the image as an encoded string in that field. I tend to stay away from putting pictures in as binary blobs as I have had issues with that. This works for relatively small images (in KB not in WidthxHeight).

  2. add a second table that has the images in (like option 1 but you have not modified the original table).

  3. add a second database (.sqlite file) that has a table like option2, but it is just in a separate dbase file.

  4. have the images sitting on the HD somewhere, and have a reference to the files in the dbase (similar to options 1,2 or 3).

now I have done #1 for some thumbnail sized images for a dbase once. the entries in that table were static (mostly static).

I have done #3 for another application that had larger images but still fairly small.

I have done #4 many times. Now this wont “encapsulate” the images in a secure method. it is just images on the HD. The client/customer could always change the images on the HD which would change the images displayed.

to get around the end-user/customer making changes to the images on file, I kept a CRC/HASH of the image file in the dbase table and before I displayed the image from the HD, I would check CRC/HASH of it against what was in the dbase and not display it if they werent the same. Just displayed an error message that the image file was corrupt.

now several people will come up with other options for you. These are the ones that came to mind.

Thank you Scott.

My planned images are either a Identity Card / Car Driver License (“Green Card”, whatever official document with a Photo) scans (so a bit small). They are small sized file (300 x 210 or 210 x 300 @ 72 dpi). The goal is to compare the real person (in front of the software user) to the person who want to get the (paper / snail) mail(s).

From your list of suggestions, I think option 2 is my preferred.

About storing the image as string: THANK YOU !
I am quite sure that I do not think to do that.

Option 4: I already have a list of countries sitting beside the application and is loaded at application firing time. I keep it there because, some countries may be missed (I took the UNESCO list of countries, the only one I found in French). Else, I put it in the project.
I understand what you wrote about “the user can change” files from the hard disk.

Actually, I just add a button that loads (on demand) an image to be displayed (printed) with the current Record (displayed in a Landscape style as a feature demo).

The charity association may (or may not) like the idea.

[quote=311784:@Emile Schwarz]Thank you Scott.

My planned images are either a Identity Card / Car Driver License (“Green Card”, whatever official document with a Photo) scans (so a bit small). They are small sized file (300 x 210 or 210 x 300 @ 72 dpi). The goal is to compare the real person (in front of the software user) to the person who want to get the (paper / snail) mail(s).

From your list of suggestions, I think option 2 is my preferred.

About storing the image as string: THANK YOU !
I am quite sure that I do not think to do that.

Option 4: I already have a list of countries sitting beside the application and is loaded at application firing time. I keep it there because, some countries may be missed (I took the UNESCO list of countries, the only one I found in French). Else, I put it in the project.
I understand what you wrote about “the user can change” files from the hard disk.

Actually, I just add a button that loads (on demand) an image to be displayed (printed) with the current Record (displayed in a Landscape style as a feature demo).

The charity association may (or may not) like the idea.[/quote]

with image sizes as you stated, converting to a string and placing in a table is not a problem. My client had images relatively the same size. And it worked very well.

If you have any questions about doing it, please let me know.
sb

Thank you Scott.

I already added the Table, the Canvas / button to load the image / coe to shrink the image to the target size (310 x ? or ? / 310) and… have a nap in the afternoon / do not had time to go ahead. I will add the needed code to Add / Modify / Clear the image (in case this will be needed) before modify and code to convert to string / string to image.

The Table contains the First Name / Last Name / Photo so I can get the Photo using First Name / Last Name (instead of relying on the Unique ID).

awesome. Good Luck!