Miscellaneous Code

  Home arrow Miscellaneous Code arrow Slide Show
MISCELLANEOUS CODE

Slide Show
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 6
    2004-08-05

    Table of Contents:

     
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement
    This is a page that can be used to display images in a folder as a slide show. It is a complete html page and should work with minor changes, as long as images meet simple criteria.
    Newbie here so be gentle when you bend me over for the rape session. Or not.

    By : paulhitz

    <html>
    <head>
    <meta name="author" value="Paul Hitz">
    <meta http-equiv="reply-to" value="paulhitz770@hotmail.com">
    <!-- This is my "junk mail" account, may take a couple tries. Put Paul John in subject -->
    <?php
    // slideshow.php
    // This program will show pictures in a folder as a slide show. The pictures need to be
    // similarly named with a number which distinguishes each picture. For instance for the
    // example, I have chosen JPEGs in a folder called images, named pic001.JPG, pic002.JPG,
    // etc. You can pause the slide show, jump ahead or jump back within the slide show and
    // and set the delay of how long a picture stays up after it is loaded.

    // Get the variables from the url(QUERY_STRING), and move into hash table $vars.
    parse_str($_SERVER['QUERY_STRING'],$vars);

    // Get value of picture, time and savetime from hash table and move into $ variables.
    $picture = $vars['picture'];
    $time = $vars['time'];
    $savetime = $vars['savetime'];


    // Build the image name including path. In this example go up one folder above where
    // slideshow.php is and go into a folder called images. The sprintf(... tells says to
    // display the number as a three digit number and pad with leading zeros, 1 = 001.
    // Hint, you could change ../images/ to a variable, put variable in url, get var from hash
    // table and access any folder on your site (and beyond).
    $picfile = "../images/pic" . sprintf("%03d",$picture) . ".JPG";

    // Increment $picture before you build next url so you go to the next picture.
    $picture += 1;
    $url = 'http://www.hitz.info/Haiti04Jun/slideshow/slideshow.php?picture=' . $picture . '&time=' . $time;

    // Decrement $picture so you pause on same picture and include save time in $urlpause to
    // fill the time input box as the default for restart.
    $picture -= 1;
    $urlpause = 'http://www.hitz.info/Haiti04Jun/slideshow/slideshow.php?picture=' . $picture . '&time=6000&savetime=' . $time;

    // Meta refresh redirect to new page in this case same page with new vars in CONTENT seconds.
    // Change if statement to be number of pictures in folder.
    // Hint create an image that says end of slideshow or some such as closure.
    $meta = '<META HTTP-EQUIV="refresh" CONTENT="' . $time . ';URL=' . $url .'">';
    if ($picture < 82)
    {
    echo $meta;
    }
    ?>
    <title>
    Slide show
    </title>
    </head>
    <body>

    <table border="1">
    <tr>
    <td>
    <table>
    <tr>
    <td rowspan="5"><img src= <?php echo $picfile; ?> >
    </td>
    </tr>
    </table>
    </td>
    <td>
    <table>
    <FORM METHOD='GET' ACTION='HTTP://www.hitz.info/Haiti04Jun/slideshow/slideshow.php'>
    <?php
    if ($time == 6000)
    {
    echo " <tr>\n <td>";
    echo "How many <br>seconds delay <br>per picture?\n";
    echo " </td>\n </tr>\n <tr>\n <td>";
    echo "<INPUT TYPE='text' NAME='time' VALUE='" . $savetime . "' SIZE='3'>\n";
    echo " </td>\n </tr>\n <tr>\n <td>&nbsp;\n";
    echo " </td>\n </tr>\n <tr>\n <td>";
    echo "Which picture <br>do you want <br>to start with? <br>(This is<br>&nbsp;slide\n";
    echo " </td>\n </tr>\n <tr>\n <td>";
    echo "<INPUT TYPE='text' NAME='picture' VALUE='" . $picture . "' SIZE='2'>\n";
    echo " </td>\n </tr>\n <tr>\n <td>";
    echo "&nbsp; of 82.)\n";
    echo " </td>\n </tr>\n <tr>\n <td>";
    echo "<INPUT TYPE='submit' VALUE='submit' NAME='submitbutton'>\n";
    echo " </td>\n </tr>\n";
    }
    else
    {
    echo " <tr>\n <td align='center'>";
    echo "<a href='" . $urlpause . "'>pause</a><br>$picture of 82\n";
    echo " </td>\n </tr>\n";
    }
    ?>
    </FORM>
    </table>
    </td>
    </tr>
    </table>
    </body>
    </html>
    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Miscellaneous Code Articles
    More By Codewalkers

    blog comments powered by Disqus

    MISCELLANEOUS CODE ARTICLES

    - Creating a Web Page Controller with the HMVC...
    - Coding Controllers and Views for the HMVC De...
    - A Sample Web Application with the HMVC Desig...
    - Adding a Class to Parse Views to an HMVC Des...
    - Building a Model Class for the HMVC Design P...
    - Filtering Input Data and Generating HTML For...
    - The HMVC Design Pattern: Working with MySQL ...
    - Dispatching Requests to MVC Triads with the ...
    - Implementing the Hierarchical Model-View-Con...
    - A Web App Based on a Model for the CodeIgnit...
    - Completing a Model for the CodeIgniter PHP F...
    - Validating Input Data with the CodeIgniter P...
    - Deleting Database Records with the CodeIgnit...
    - Inserting Database Records with a CodeIgnite...
    - Fetching Database Rows with a Model for the ...


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 5 - Follow our Sitemap