• Resolved kelcet

    (@kelcet)


    Hi, plugin has been working fine for following code until update a few versions back. I reverted to old version and code would work. However I updated today and receive error. Cannot find my old copy so should fix current error. Thanks for your help.
    Code has been pulling last image that is uploaded to folder from webcam on island.
    You can see error on nyc.nu

    $pictures = glob("TLIP/*.jpg"); 
    $no_pictures = count($pictures)-1;  // was missing ;
    $limit = $no_pictures-0;            // was missing ;
    for( $i = $no_pictures; $i >= $limit; $i--){  // removed ; after $i--
    echo "<img src=\"".$pictures[$i]."\" />"; 
    }

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

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter kelcet

    (@kelcet)

    Had some comments about no current image. yachties use it to keep track of conditions in bay so did restore to Version 2.5.4. code works there.

    Does this version work (it does for me)

    $pictures = glob("TLIP/*.jpg"); 
    $no_pictures = count($pictures)-1; 
    $limit = $no_pictures-0;       
    for( $i = $no_pictures; $i >= $limit; $i--){ 
    echo '<img src="$pictures[$i]" />'; 
    }
    Thread Starter kelcet

    (@kelcet)

    Hi, sorry for delay currently out of country and reliable computer will try when home.

    Thread Starter kelcet

    (@kelcet)

    Hi with 3.0.5 On page I see…

    $pictures = glob(“TLIP/*.jpg”); $no_pictures = count($pictures)-1; $limit = $no_pictures-0; for( $i = $no_pictures; $i >= $limit; $i–){ echo ”; }

    Did you check the PHP checkbox?

    Thread Starter kelcet

    (@kelcet)

    opps. No. Now I get generic image for where image should be. So we are getting closer. see on nyc.nu home page. Thanks

    Where should I look? There are multiple images.

    Thread Starter kelcet

    (@kelcet)

    On left side of page I put a line above where image should display saying

    “LAST IMAGE FROM WEBCAM FOLDER – below”

    using code from above…
    $pictures = glob(“TLIP/*.jpg”);
    $no_pictures = count($pictures)-1;
    $limit = $no_pictures-0;
    for( $i = $no_pictures; $i >= $limit; $i–){
    echo ‘‘;
    }

    Thread Starter kelcet

    (@kelcet)

    Have solved issue. Went with different code. For those looking the folder where webcam images upload to is nyc . nu / TLIP / imagefilenamebydate.jpg

    $dir = 'TLIP';
    $base_url = '/TLIP';
    $newest_mtime = 0;
    if ($handle = opendir($dir)) {
        while (false !== ($file = readdir($handle))) {
            if (($file != '.') && ($file != '..')) {
                $mtime = filemtime("$dir/$file");
                if ($mtime > $newest_mtime) {
                    $newest_mtime = $mtime;
                    $show_file = "$base_url/$file";
                }
            }
        }
    }
    print '<img src="' .$show_file. '" alt="Mooring Image">';

    Thanks Kevin

    Great!

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘syntax error, unexpected ‘”‘, expecting ‘,’ or ‘;’’ is closed to new replies.