SunQuest
 
       Site Navigation Code
  Home arrow Site Navigation Code arrow Simply image viewer script
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Forums Sitemap 
Dedicated Servers  
Download TestComplete 
IBM® developerWorks
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
SITE NAVIGATION CODE

Simply image viewer script
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 5
    2005-08-20

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    This script reads images in your dir and displays first one with next prev buttons. No work needed just drop in dir. Also gives thumbnail option and links at bottom to each image in the dir

    By : eltreno

    <?php

    //=========================================
    //
    // Author: Trent Williams
    // Date: 19 Aug 2005


    // EXPLAINATION
    //
    // A simply script to drop in any dir to display next prev buttons and current image for all your images in that dir with extentions you allow
    // Uses id parameter to know what image to show next else it will show first image
    // Also a number list at bottom page to go to any image, alt text displays image name

    // change the colours in the styles in the html body






    //which dir
    $d = dir(".");

    //read thru and
    while (false !== ($entry = $d->read())) {
    //allow extensions here
    //|| preg_match("/(\.bmp$)/i", $entry)
    //|| preg_match("/(\.jpeg$)/i", $entry)

    if (preg_match("/(\.gif$)/i", $entry) || preg_match("/(\.jpg$)/i", $entry)){
    $pics[] = $entry;
    }

    }
    $d->close();


    //================
    //total images count
    $numPics = count($pics);



    //================
    //picture in array to show on this page
    $thispic = 0;
    if (is_numeric($_GET['id'])){
    $thispic = $_GET['id'];
    }
    $thispicDisplay = $thispic + 1;



    //================
    //img tag for current image
    $thisImage = '<img src="' . $pics[$thispic] . '" alt="' . $pics[$thispic] . '" />';



    //======================
    // START set thumbnails on or off

    //comment this section out if you don't want thumbs to show at all

    $showThumbs = 5;//number of thums to show
    $thumbsList = '';
    $thumburl = '';
    if ($_GET['thumb'] == 'yes'){
    //read thumb param to url if exists
    $thumburl = '&amp;thumb=yes';

    for ($i=0;$i<$showThumbs;$i++){
    if ($thispic + $i + 1 < $numPics){
    $currThumb = $thispic + $i + 1;
    $thumbsList .= '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $currThumb . $thumburl . '" title="' . $pics[$currThumb] . '"><img src="' . $pics[$currThumb] . '" alt="' . $pics[$currThumb] . '" height="100" width="100" border="0" /></a>&nbsp;&nbsp;&nbsp;';
    }
    }
    $onOff ='<a class="thumbs" href="' . $_SERVER['PHP_SELF'] . '?id=' . $thispic . '">Turn Thumbnails Off</a>';
    } else {
    $onOff ='<a class="thumbs" href="' . $_SERVER['PHP_SELF'] . '?id=' . $thispic . '&amp;thumb=yes">Turn Thumbnails On</a>';
    }

    // END set thumbnails on or off





    //prev button

    $prevurl = ' <span class="highlighted">First Picture</span>';
    if ($thispic > 0){
    $prev = $thispic - 1;
    $prevurl = '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $prev . $thumburl . '" title="' . $pics[$prev] . '">Previous picture</a>';
    }




    //next button

    $nexturl = ' <span class="highlighted">Last Picture</span>';
    if ($thispic < ($numPics - 1)){
    $next = $thispic + 1;
    $nexturl = '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $next . $thumburl . '" title="' . $pics[$next] .'">Next picture</a>';
    }



    //=======================
    // string of all pics url's
    $urlarray = '';
    for ($i=0;$i<count($pics);$i++){
    //highlign pic you are on
    $j = $i + 1;

    if ($i != $thispic){

    $urlarray .= '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $i . $thumburl .'" title="' . $pics[$i] . '">' . $j .'</a> ';
    } else {
    $urlarray .= ' <span class="highlighted">' . $j . '</span> ';
    }


    }







    ?>
    <?php echo '<?xml version="1.0" encoding="iso-8859-1"?>' . "\n"; ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title><?=$pics[$thispic]?></title>
    <meta name="Author" content="Trent Williams" />
    <style type="text/css">
    *{margin:0px;}
    html, body{color:#000; background-color:#000;}
    .borders {background:#DBDE5C; border:2px solid #DF1C11; padding:10px; width:100%; float:left; font-family:arial, helvetica, sans-serif; font-size:85%;}
    .content {padding:10;}
    a{color:#000;text-decoration:none; font-weight:bold;}
    a:hover{text-decoration:underline;}
    .highlighted {color:#DF1C11; font-weight:bold;}

    a.thumbs {color:#DBDE5C;text-decoration:none; font-weight:bold;}

    </style>
    </head>

    <body>


    <table cellpadding="0" cellspacing="10" border="0">
    <tr>
    <td>

    <div class="borders"><?=$prevurl?>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<?=$nexturl?>&nbsp;&nbsp;&nbsp;Picture number: <strong><?=$thispicDisplay?></strong> &nbsp;&nbsp;Picture name: <strong><?=$pics[$thispic]?></strong></div>




    <div class="content"><center><?=$thisImage?></center></div>

    <div class="content"><?=$onOff?><center><?=$thumbsList?></center></div>

    <div class="borders"><?=$urlarray?></div>


    </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 Site Navigation Code Articles
    More By Codewalkers

     

    IBM® developerWorks developerWorks - FREE Tools!


    Check out the new Jazz space on developerWorks

    <a href="http://zeus.developershed.com/shonuff.php?blackbird=3853&zoneid=442&source=&dest=http%3A%2F%2Fwww.ibm.com%2Fdeveloperworks%2Fspaces%2Fjazz%3FS_TACT%3D105AGY31%26S_CMP%3DDEVSHED&ismap="><img src="http://images.devshed.com/corp/img/news/jazz01.gif" alt="developerWorks Jazz space" align="left"></a>You've heard the buzz about Jazz... want to know more about it from a developer's perspective? Check out the Jazz space on developerWorks. This space is an up-to-date resource for developers, including technical information about Jazz and products built on Jazz, like Rational Team Concert Express. The Jazz space includes content from a wide variety of sources, including links, feeds, and comments from experts.
    FREE! Go There Now!


    NEW! IBM – Taking Web 2.0 to Work

    David Barnes, Lead Evangelist for IBM Emerging Internet Technologies will discuss aspects of Web 2.0 that bring value to corporations, academia, and government. He'll also discuss IBM's vision around Web 2.0, including the importance of remixability and consumability. The discussion will culminate with examples of various IBM Software Group solutions you can use to get ahead of the Web 2.0 adoption curve.
    FREE! Go There Now!


    NEW! Info 2.0: Harnessing the power of Web 2.0 and Enterprise Mashups

    Listen to this webcast to get an overview of Info 2.0 and a technical demo of how to quickly build an enterprise mashup. IBM's Info 2.0 technology leverages emerging Web 2.0 technologies such as mashups, feeds, AJAX, and JSON in order to simplify assembly of information using feeds and services. Come learn about the technical elements of Info 2.0 including the Feed Generation framework, Mashup Engine, and mashup assembly components. Learn how to pull information from databases, departmental information, and the Web to create mashups critical to your company’s success. We will also discuss best practices to help you get started.
    FREE! Go There Now!


    NEW! Rational Talks to You: Grady Booch on Architecture

    Join this Rational Talks to You teleconference on November 29 at 1:00 pm ET to participate in an interactive discusssion with Grady Booch around architecture and reuse. Get your questions answered!
    FREE! Go There Now!


    NEW! Successful Change and Release Management for .NET

    Join this webcast to discover the key requirements for successful change and release management. Learn how to extend your .NET environment to improve productivity and collaboration, and address core problems afflicting team development. In this webcast, we’ll review typical challenges faced by customers and how to resolve them with the IBM Rational Change and Release Management solution, including Rational ClearCase, Rational ClearQuest and Rational Build Forge. Replay is available for 9 months.
    FREE! Go There Now!


    NEW! Trial download: IBM Informix Dynamic Server Express Edition V11.0

    Informix Dynamic Server (IDS) Express Edition offers outstanding online transaction processing (OLTP) database performance, while helping to simplify and automate many of the tasks associated with deploying databases for small business applications. IDS 11 further extends the ease of management and applications integration with the Admin API and Scheduler, high availability with Continuous Log Restore for backup server recovery in case of a primary server failure, and column level encryption to protect personal and company private data.
    FREE! Go There Now!


    NEW! Trial download: IBM Rational Tester for SOA Quality V7.0.1

    Get a free trial download of the latest version of IBM Rational Tester for SOA Quality V7.0.1, a functional and regression testing tool that enables the creation, comprehension, modification and execution of testing GUI-less Web services.
    FREE! Go There Now!


    NEW! Webcast: Application security testing and Web compliance

    Join the IBM Watchfire team for an informative discussion on techniques and best practices to proactively manage Web application security and how to effectively build application security testing into the software development lifecycle (SDLC). In this Software Delivery Platform webcast you will learn: How to better understand potential web application security vulnerabilities, best practices and how to effectively integrate application security testing into the software development lifecycle, the importance of detecting and removing software vulnerabilities during application development.
    FREE! Go There Now!


    NEW! Webcast: Calling All Testers! Find Application Vulnerabilities Early in the Development Process Where they are Easier to Fix and Less Risky to your Business

    In this webcast, IBM Rational will discuss the importance of Web application security and will share techniques and best practices to introduce application security testing into current QA processes including: understanding common security vulnerabilities and techniques to integrate security testing with defect tracking and remediation systems in an effort to safeguard sensitive online information.
    FREE! Go There Now!


    NEW! Webcast: WebSphere Process Server

    WebSphere Process Server delivers a unique integration framework that simplifies existing IT resources. Often, as IT assets grow to support business demand, so too does their complexity and manageability. In this webcast, we’ll discuss how WebSphere Process Server helps deliver an SOA infrastructure that provides a common model to orchestrate, mediate, connect, map, and execute the underlying IT functions. Discover how WebSphere Process Server simplifies integration of business processes by leveraging existing IT assets as reusable services without the complexities of traditional integration methodologies.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    SITE NAVIGATION CODE ARTICLES

    - Simple Menu System
    - Simply image viewer script
    - Simple File Lister
    - Dynamic Error Pages
    - BSoftEditor
    - Yahoo Status
    - Page numbers
    - PHP Search Navigator 1.0
    - Simple Page Navigation
    - An easy page browser ( prev 6 7 8 9 10 next )
    - AutoIndex PHP Script (Directory Indexer)
    - Bs_HtmlNavigation (Navigation and Sitemap cl...
    - Another Paging with Stage
    - Website Navigation via PHP
    - MySQL Paging Class






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway