Preston Crawford wrote:
I'm looking to quickly get a photo album online. Very simple, thumbnails,
a few pages, maybe a description, but hopefully a small script that's easy
to edit and work into my existing site. I know about hot scripts, etc. but
I was wondering if any one could recommend one?
Secondly, I also want to setup a journal. It's not really a "blog"
although I guess blog software may work. But it isn't going to be a
message board or anything like that. Just a place to put out random bits
of news. Once again, same premise, I'm trying to find the most simple
script possible that could basically traverse a directory of simple
textfiles and produce a list.
I know all about Blosxom and stuff like that, but I'd like a script that
just did the above and didn't overtake my site like PHPNuke or something
like that. I'll probably roll my own, but I thought I'd check first.
Preston
here is one I have used in the past.. not sure how well I liked it as it has
been a while since I have seen it and it has not been updated to PHP 4.x.x
_GET,_POST so YMMV. Also some of the lines may have wrapped and you will need
to fix those before it will work.
I found it using google... You can find almost anything (code wise) using google.
<?php
////////////////////////////////////////////////////////////////////////////////
////////////////////////
// NAME:
// imagebrowser.php
//
// VERSION:
// Version 1.0 - 18/07/01
//
// Version 1.2 - 05/10/01 (Je**********@UnderGrid.net)
// - Cleaned up HTML code so it works on both Netscape and IE cleanly
// as it appeared to only work under IE as written. Stylesheets still
// need work for Netscape but work under IE
//
// AUTHOR:
// Jo Demol (de*********@yahoo.com)
//
// DESCRIPTION:
// Drop this file in any directory that you want and it automaticaly generates
// an easy to use browsable interface for your images
//
// RETURNED VARIABLES:
// no variables are returned
//
// Configuration Variables
// ======================
//
// imgperpage : the number of thumbnail images displayed
// its best to give this a value that is a multiple of imgperrow
// imgperrow : the number of thumbnail images per row
// typelist : array that contains the imagetypes shown by the browser
// currentdir : default the directory where this php file resides,
// can be replaced by any directory of your choice
// title : enter the title of your page here
// home : enter path to your home directory or any other desired direct
ory
// stylesheet : enter the path to your stylesheet here
// the stylesheet should have these classe:
//
// .imag { border-style : solid;
// border-color: blue;
// border-width : 1px;}
// .thumb { border-style : solid;
// border-color: #999999;
// border-width : 2px;}
// A:link { color: #999999;
// text-decoration : none; }
// A:visited { color: #999999;
// text-decoration : none; }
// A:hover { color:blue; }
// any of these classses can be adjusted to your needs
//
// USAGE:
// to browse through the images use the back and forward images
// click on one of the thumbnails
// or use one of the pagelinks to go directly to another set of images
// clicking on the large image will give you the full image
////////////////////////////////////////////////////////////////////////////////
/////////////////////////
//---Variables---
$imgperpage = 8;
$imgperrow = 4;
$currentdir = getcwd ();
$typelist = array("jpg","jpeg","gif","png");
$imagelist = array();
$title = "the showroom";
$stylesheet = "" ;
$home = "https://www.spacelots.com/litschauphotos/imagebrowser.php";
//--- ind is put to zero when the script is first called uppon---
if(!isset($_GET['ind']))
$ind = 0;
$index = $_GET['ind'];
//---the following code iterates through the directory
//---and puts any image found in the imagelist array---
$dp=opendir($currentdir);
while ( false != ( $file=readdir($dp) ) ) {
if (is_file($file) && $file!="." && $file!=".."){
$extention = explode(".",$file);
$extention = $extention['1'];
if( in_array($extention,$typelist) ){
array_push ($imagelist,$file);
}
}
}
?>
<html>
<head>
<title><?php echo $title ?></title>
<LINK REL="STYLESHEET" HREF="<?php echo $stylesheet?>">
</head>
<body bgcolor="#eCeC0F">
<table align="center" border=0>
<tr>
<td>
<? if($index-1 >= 0) {?>
<a href='imagebrowser.php?ind=<? echo $index-1 ?>'>[ prev ]</a>
<? }
else
{
echo " ";
} ?>
</td>
<td>
<a href='<? echo $imagelist[$index] ?>' target='_blank'><image src='<? echo $i
magelist[$index] ?>' class='imag'></a>
</td>
<td>
<? if($index+1 < count($imagelist) ) {?>
<a href='imagebrowser.php?ind=<? echo $index+1 ?>'>[ next ]</a>
<? } ?>
</td>
</tr>
</table>
<br>
<table align="center">
<tr>
<?
//---this code generates the thumbnails based on the configuration settings---
$nrpages = ceil( count($imagelist)/$imgperpage );
for($j=0;$j<$nrpages;$j++)
{
if( $index >= ($j*$imgperpage) && $index < (($j+1) * $imgperpage) ) {
for($i=($j*$imgperpage);$i<(($j+1) * $imgperpage);$i++) {
if(($i%$imgperrow == 0) && ($i > 0)) { ?>
</tr>
<tr>
<? } if($i <count($imagelist) ) {
$path = "imagebrowser.php?ind=".$i; ?>
<td>
<a href='<? echo $path ?>'><img src='<? echo $imagelist[$i] ?>' width='50' he
ight='50' class='thumb'></a>
</td>
<? }
}
}
}
?>
</tr>
</table>
<br>
<center>
<?
//---this code generates links based on the configuration settings---
for($j=0;$j<$nrpages;$j++)
{
echo "<a href='imagebrowser.php?ind=".($j*$imgperpage)."'>" ;
echo "[page ".($j+1)."]";
echo "</a>";
}
?>
</center>
<center> <a href="<? echo $home ?>">[ home ]</a></center>
</body>
</html>
--
Michael Austin.
Consultant - Available.
Donations welcomed.
Http://www.firstdbasource.com/donations.html
:)