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; }
//================ //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 = '&thumb=yes';
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.