• I have a SLR camera that upload a new picture every hour to my ftp catalogue, but how can I show the latest picture using wordpress !

    Any idea ?

    • This topic was modified 3 years, 10 months ago by svein1958.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • <?php
    $path = "your_folder_path_here/*";
    $latest_ctime = 0;
    $latest_filename = '';
    $files = glob($path);
    foreach($files as $file){
            if (is_file($file) && filectime($file) > $latest_ctime){
                    $latest_ctime = filectime($file);
                    $latest_filename = $file;
            }
    }
    echo $latest_filename;
    ?>

    Change your_folder_path to your folder and the code should echo out the name of the latest file in that folder.

Viewing 1 replies (of 1 total)
  • The topic ‘How can I show the latest picture from a certain catalogue’ is closed to new replies.