Subject Re: Closing an image on a form
From roy price <royprice@royprice.name>
Date Mon, 03 May 2021 03:10:00 -0400
Newsgroups dbase.getting-started

Mervyn Bick Wrote:

Hello Mervyn,
It seems that windows retains the "Date Taken" for some files (Images only?), but it is not normally visible unless selected (right click heading in Explorer).
So I used a program called DirectoryListPrint to list the directory where the images are, (including the "date taken") and spent a couple of hours editing the results for consistency, before writing a quick program to load the image dates into my table.
Also Libre Office's spreadsheet has an option to capitalise the first character of all words, so I'm considering using that function if I can download the text field, modify it and upload again.
Regards
Roy Price

> On 2021/05/02 12:09, roy price wrote:
> > Hello Mervyn,
> > I did use your (simpler) code to relate the filenames from the disk directory to the image on the Form.
> > I am now wondering if a similar code would extract the date-taken from the same filename. I've tried but failed.
> > Regards
> > Roy Price
> >
>
> The date and time that the photo was taken may (not all cameras are
> fully house-trained) be in the EXIF meta data in the photo.
>
> I looked at the EXIF specification and data in some of my own photos and
> decided that writing code for this task was above my pay-grade. :-(
>
> There are several activeX controls that are available to get this
> information but they all cost money.
>
> As my middle name is Scrooge I looked for something free even if it
> meant going the scenic route to get there.
>
> I found Exiftool which is free and which has a command line option.
> I've built a little program around this.  You will, of course, need to
> fetch a copy of Exiftool.  I used the alternative installer from
> https://oliverbetz.de/pages/Artikel/ExifTool-for-Windows
>
> Not all photos have the information saved so this may not be of much help.
>
> If it works you will wind up with a table exif_dates.dbf which will have
> the names and timestamps of those photos which do have the timestamp in
> the EXIF data.
>
> You will need to edit the values for cDir and cTextFile as appropriate.
>
> Mervyn.
>
>
>
>
>
> cDir = "d:\pictures"
> cTextFile = "d:\examples\plus2019\EXIF_dates.txt"
>
> if file(cTextFile)
>   new File().delete(cTextFile)
> endif
> f = new file()
> f.create('ex_exif.bat')
> f.puts([exiftool -p "$filename has date $dateTimeOriginal" -q -f  ]+cDir+[ >> ]+cTextFile)
> f.close()
>  if (type("WinExec") # "FP")
>       extern CWORD WinExec(CSTRING, CUINT) Kernel32
> endIf
> SW_HIDE = 0
> WinExec('ex_exif.bat'+Chr(0), SW_HIDE)
>
> inkey(2) //Wait for text file to be written and closed.
>
> if file("exif_dates.dbf")
>    drop table exif_dates
> endif
>
> create table exif_dates (image_name char(20),exif_timestamp timestamp)
> q = new query()
> q.sql = 'select * from exif_dates'
> q.active = true
> f = new file()
> f.open(cTextFile)
> do while not f.eof()
>   cRead = f.gets(10000)
>   if ':'$cRead
>      q.rowset.beginAppend()
>      q.rowset.fields[1].value = substr(cRead,1,at(' ',cRead)-1)
>      q.rowset.fields[2].value = substr(cRead,at('date',cRead)+5)
>      q.rowset.save()
>   endif
> enddo
> f.close()
q.active = false