First of all, I would like to thank everyone who has replied to my question so far.
I am very surprised at the multitude of answers (all were qualified, no "yearwoods")
Meanwhile, the argument has convinced me, that the image files
should not be embedded in a VFP table.
That's why I changed the field types in the table for taking over the image descriptions, they are all of the Character type
now.
The SCOTT24x7 program (see at bottom) runs very quickly with it
and automatically assigns a 4-digit number to each image as well
the name of the picture:
The image file with over 500 watercolors, drawings and experiments by me which were created in the last 20 years and looks like this, for example.
For these pictures I also have written references to the
content made that still needs to go into the "Titel - engl.= "Title" column.
e.g. "mountains", "trees", "animal name", "beach" etc.
It should then also be possible to display groups of images with similar content or similar size on the screen using an SQL query.
I recently spent an awfully long time looking for a certain painting of mine - hence the idea of speeding up such a searchit with VFP in future.
With the picture no. and the image on the content, I can find a specific painting much faster.
I still have to think about how to get old frame numbers
can hold on to if new photos of my paintings are added to the inventory.
But that is not an issue in the moment.
Should perhaps be a separate program.
I hope I have specified the goal of my thread.
Regards
Klaus
Code:
*Program: getbild.prg
*This code was written by Scott24x7 (see text at the end of this code) and small modified/adjusted by me.
*It fills the following columns of table Mypics with a generated 4-digit number
*in field NUMMER, and the description of *.jpg images in field Bild
*the images reside together with this program in folder C:\entw\produkt\bilderhol\mypics.dbf
*All field-types in Mypic.dbf are characters.
Close Data
Use Mypics In 0 && Open the table
&& Table structure: Nummer c(6) , Titel c(60),Bild c(60)
*-- Get the number of files in the "mypics" folder
lcFolderPath = "C:\entw\produkt\bilderhol\mypics.dbf" && Replace with the actual path to the folder
lnFileCount = Adir(laDirInfo,lcFolderPath + "*.jpg") && Replace ".jpg" with the actual file extension of your pictures
CLEAR
*-- Loop through the files and add a record for each file
For i = 1 To lnFileCount
lcPicturePath = lcFolderPath + laDirInfo[i, 1]
lcNummer = Padl(i, 4, "0") && Generate a 4-digit padded number for the record
Insert Into Mypics (Nummer, Bild) Values (lcNummer, Filetostr(lcPicturePath))
Endfor
Browse
Close Databases
*!* ------------------------------------------------------------------------------------------------------------------------
*!* this was the Orginal-code by SCOTT24x7
*!* USE Mypics IN 0 && Open the table
*!* *-- Get the number of files in the "mypictures" folder
*!* lcFolderPath = "C:\path\to\mypictures\folder\" && Replace with the actual path to the folder
*!* laFiles = ADIR(laDirInfo, lcFolderPath + "*.jpg") && Replace ".jpg" with the actual file extension of your pictures
*!* lnFileCount = laFiles[0]
*!* *-- Loop through the files and add a record for each file
*!* FOR i = 1 TO lnFileCount
*!* lcPicturePath = lcFolderPath + laFiles[i, 1]
*!* lcNummer = PADL(i, 4, "0") && Generate a 4-digit padded number for the record
*!* INSERT INTO Mypics (Nummer, Bild) VALUES (lcNummer, FILETOSTR(lcPicturePath))
*!* ENDFOR
*!* *-- Close the table
*!* CLOSE DATABASES
Peace worldwide - it starts here...