This page has been loaded   times.
(Counter added when programming page counter at 291 total / 237 unique)
Zooks.info Home Page | Programming page | Contact me

// Script for PHP picture show.
// Pic, thumbnail and caption text files all have to be uploaded for each pic.
// You should be able to copy and paste directly from this page
// if you want to use this...it worked for me in dreamweaver, anyway.

 //  Put the main script before the <head> tag.
<?php
 //  Declare variables.
 //  I don't know if these have to be global or not.
global $picList;
global $indx;
global $nindx;
global $pindx;
global $thumDir;
global $capsDir;
global $showDir;
global $indx;
$thumDir = "thumbs/t"; //  I prefix thumbs with a 't' so i don't use identical file names.
$capsDir = "caps/";
$showDir = "show/";
$indx = 0;
 //  Open the directory, read all the file names and load them into an array...
$dir = opendir($showDir);
while ($f = readdir($dir)) // read and sort by date of creation
if(is_file($showDir.$f)) {
 //  ...but strip off the extension so we can use the same array for pics, thumbs and captions.
$picList[$indx] = substr($f, 0, strlen($f) - 4);
$indx++;
}
closedir($dir);
 //  Read the 'indx' variable from the page request to see which pic to display.
 //  Really should set a defaule here, but right now I am just making sure to always call the page with a paramater.
 //  Either way, we have to do this, because the page calls itself with the next and previous links.
$indx = $_GET['indx'];
 //  Set the next and previous indexes and be sure they fall within the size of the array.
 //  We will use these to display the thumbnails and as paramaters to pass when calling another page.
$lenList = (count($picList) - 1);
$nindx = $indx + 1;
if($nindx > $lenList) {
$nindx = 0;
}
$pindx = $indx - 1;
if($pindx < 0) {
$pindx = $lenList;
}
 //  Open the text file for the caption, read the entire file and pass it pack to the PHP section which will display it.
function getCap($d, $p) {
$fCap = fopen($d.$p.".txt", "r");
$cap = fread($fCap, filesize($d.$p.".txt"));
return $cap;
}
?>

 //  Display the main picture and the caption.
<?php
echo "<img src=\"".$showDir.$picList[$indx].".gif\">";
echo "<center>".getCap($capsDir,$picList[$indx]);
?>

 //  Display the 'next' thumbnail in a link which will reload the page for the 'next' index.
<?php
echo "<center><a href=\"show_no_js.php?indx=".$nindx."\">";
echo "<img src=\"".$thumDir.$picList[$nindx].".gif\">";
echo "<br>Next<br>Image</center></a>";
?>

 //  Display the 'previous' thumbnail in a link which will reload the page for the 'previous' index.
<?php
echo "<center><a href=\"show_no_js.php?indx=".$pindx."\">";
echo "<img src=\"".$thumDir.$picList[$pindx].".gif\">";
echo "<br>Previous<br>Image</a></center>";


Warning: Cannot modify header information - headers already sent by (output started at /home/dlilahl/public_html/PHP/phpPicShow.php:5) in /home/dlilahl/public_html/PHP/ICMmerge.txt on line 2
JFIF>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality C    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222,," }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ? sNsN")P8 ")@ H1NS- bH v(HLsNS- SH P)@Z$Z@!("Xi)*%SHYCDdSHYCDdSHHP 7Ԙ͢#"EHE4hB)SH!SHYCDdSqRMCD4;ӀiVS piS pEF)UZ@;Nhi8 Z$RAiQiUZ@8 Z$ZBN)UZAh"UBFE4i )TP M""Ef M""ECD4FE7)sYCCRM"hM""ECD4FE4iD40n*LSqP 4(4+DH@)P8 H1N)Vb&)VS@*- Z$ZAiQpE (ZES piA9h]ȦRbECD4FE7!*%2)TSH!"ECD4Gn*LSHhȦRM"hM""ECD4FE4iD4FE&)RbZ(8 H@+DH piF)VNSZ$Z@8 Z$ZBbVi(ZERJ8 ")Av.DSHHP "EHE4͢Z#"EHE4͢E0a )74CDdSHYCDx"B+6hi!+6hn*B)h;bZES pib Z$RApbhiP8 H1JS- pbZES pESZE$PE8h"b2)TSHhM""ECDFE4iD4FE4i SqHE3D40i!+6hi!*!SHM"hMIn*%اF)ثH +DH@*- 4)1OH@)ح- SHiQpER@*- S- )ؠhUȦRM"Z#"EHE4͢E4y+6ha*B)T4CDdSqIn9!SHM"ZE4~)!2)TSH!H(&iMC%Қil4JM4l4SM& iJi6KM4k6Cbi4PlCHh4YMT2p5i&JdӁVi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