-2

Hello I have a webcam 'foscom' that send automatic snapshot every 30minutes a pictures to this folder in my ftp "testcamera/img"

I was able to create a code that display the latest image uploaded in php.

But i want also to display a drop down menu that display all old image that's mean i will let the viewer to choose another picture and display it. An example of the idea i want: http://www.skileb.com/webcam/mzaarv/ My Sample look like this: www.stevendahdah.com/testcamera/index.php

So anyone can help me?

  • 1
    Can you upload the code you are using to display the latest uploaded image? – Anudeep Bulla Nov 28 '13 at 06:58
  • did you try and look how to get a dropdown in html (` – Nanne Nov 28 '13 at 08:08
  • Dear @Nanne i created a dropdown menu and i displayed all the image in this menu but i didn't know hot to select the image but not i will try it. – user3025952 Nov 28 '13 at 08:25
  • And for @AnudeepBulla i am ussing this code: = $limit; $i--){ // removed ; after $i-- echo "\n"; } ?> – user3025952 Nov 28 '13 at 08:26

1 Answers1

0

Here is a link that will get you started :

sort files by date in PHP

Getting the first or last file is merely getting the correct element from your sorted array :

$latest_file = $files[1];
$oldest_file = $files[count($files)];

You can create a image tag

echo '<img src="/dir/where/files/are/'.$latest_file . '" />';

For the rest, you can create links

for ($i  = 2;  $i <= count($files); $i++) {
   echo '<a href="/dir/where/files/are/'.$latest_file . '" />' . $latest_file . '</a>';
}
Community
  • 1
  • 1
crafter
  • 6,246
  • 1
  • 34
  • 46
  • Thanks i will try it, there is a code to rename the image file automatically by date and time when uploaded to ftp from the webcam? snapshot examples names:00626E45AAFB(e1)_0_20131127153812_12 00626E45AAFB(e1)_0_20131127153842_13 i want 00626E45AAFB(e1)_0_20131127153812_12 i want to be: 03:38:12-27112013 or something like this. Thanks – user3025952 Nov 28 '13 at 08:24