Page 1 of 1

Show latest image from folder

Posted: Monday 26 December 2016 9:57
by johan99
Hi,
I've got a camera (Vistacam) wich I'm unable to add to domoticz. However, I'm OK with showing fotos from it. But it puts images in a folder and all image files gets different names. Is there a simple way to show the newest image file from a folder? I'd like to add that code to my frontpage.html.

/Johan

Re: Show latest image from folder

Posted: Monday 26 December 2016 10:03
by Egregius
What is the filename structure?
You're ok with php?

Re: Show latest image from folder

Posted: Monday 26 December 2016 10:38
by johan99
The camera stores jpg-files in a folder:
c:\Domoticz\www\cams\chicken
on a windows server.
the files are named similar to this: VSTA016411UKFLZ_0_20161226085543_5.jpg

I'm new to PHP but it could be a good reason to start learning :D

Re: Show latest image from folder

Posted: Monday 26 December 2016 12:28
by Egregius
The first part is always the same? Then a date/time stamp with a sequential number at the end?
How often do they update?
Maybe I'll write something tomorrow with the php glob function. Can't be to difficult with such names.

Re: RE: Re: Show latest image from folder

Posted: Saturday 07 January 2017 9:31
by stlaha2007
johan99 wrote:The camera stores jpg-files in a folder:
c:\Domoticz\www\cams\chicken
on a windows server.
the files are named similar to this: VSTA016411UKFLZ_0_20161226085543_5.jpg

I'm new to PHP but it could be a good reason to start learning :D
Why not schedule (previously know as AT) a batchfile (or 2) to copy the latest into say c:\domoticz\www\vesta_image.jpg.

Windows standard is to write date/timestamp with LastModified so u can use that for your Latest Image.

After that you can setup a 'static' camera within Domoticz with the url http://domo-ip:domo-port/vesta_image.jpg

And to clean up say daily another to copy/move the last whole day to c:\image_bak\year\month\day

Basic commands are available for these methods in windows. Or learn PowerShell which you give fine grained control over date/time etc.