Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Posts
    58

    Unanswered: dispaly one image at once

    Hallo,

    I have a list of images from a directory I want to dispaly them
    inside a div, juste the same left corer of the screen. After every 2 seconds, I displays the next image. At the end, I start to the begin. Just a loop.

    I've looked over all forum I cannot find the php script to do it.

    Here the code I use, it displays all images, but me i want dispaly ONE image at once at the same place.

    <?php
    // url of images location
    $urlphoto = "http://localhost/gallerie_photos";

    // directory of images
    $namedirectory = "gallerie_photos";
    if (is_dir($nomRepertoire))
    {
    $dossier = opendir($namedirectory);
    while ($myfile = readdir($dossier))
    {
    if ($myfile != "." AND $Fichier != ".." AND (stristr($Fichier,'.gif') OR stristr($Fichier,'.jpg') OR stristr($Fichier,'.png') OR stristr($Fichier,'.bmp')))
    {
    // size of images
    $h_vign = "120";
    $l_vign="120";

    echo '<img src="', $urlphoto, '/',$myfile, '" ';
    echo "width='$l_vign' height='$h_vign'>";

    }
    }
    closedir($dossier);
    }else{
    echo' directory dosn't exist';
    }
    ?>

    thanks in advance,

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    You're going to have to go with JavaScript I think, because this would be a client-side operation...
    George
    Home | Blog

  3. #3
    Join Date
    Mar 2004
    Posts
    58
    thanks,

    Do you have any idea, how I can handle with this issue ?

    thanks,

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    georgev is correct.. I'd do it as either plain vanilla javascript or as an AJAX asynchronous process.

    as to how you do that I'd try a Javascript forum.

    one thing to bear in mind is if you are lloking for a 2 second screen show, they you probably need to preload the images before kicking off the slide show.

    I'd be very careful about including a slide show, some users find them annoying and distracting.

    you cannot do this a a PHP script, as this runs once on the server, whereas you want images displayed on the client browser something beyond the scope of PHP (or ASP) or any form of scripting language.
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Mar 2004
    Posts
    58
    thanks all of you, i may be need a small idea about the code, how to write it ?

    thanks

  6. #6
    Join Date
    Mar 2007
    Location
    636f6d7075746572
    Posts
    770
    Then I suggest you post a question in the javascript forum.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •