ozlad
03-06-2007, 08:22 PM
Hi,
I wrote this slideshow script for a real estate site a few years back and recently altered it slightly for a used vehicle site, worked just fine until the host upgraded the server to PHP 5.
This script resides in the same directory as the photos (up to 5). It takes the names of files beginning with "t_" (thumbnails) and puts them into an array. Then does its thing.
PHP 5 appears to be screwing up the count.
Can anyone tell me why this is so?
<html>
<head>
<style>
body { margin: 0px; }
a { font-family: arial; font-size: 12px; font-weight: normal; color: white; text-decoration: none; }
a:hover { font-face: arial; font-size: 12px; font-weight: normal; color: white; text-decoration: underline; }
</style>
</head>
<body bgcolor="#666666">
<table border="0" cellpadding="0" cellspacing="0" align="center">
<tr><td colspan="2" align="right">
<a href="javascript:window.close();"><img src="../../images/close.gif" width="105" height="18" border="0"></a></td></tr>
<tr><td colspan="2" align="center">
<?php
if(!isset($start)) $start = 0;
$pics = Array();
$number = "1";
$handle = opendir(".");
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (!strstr($file, "t_")) {
$pics[] = $file; }
}
}
closedir($handle);
$total = (count($pics) - 1);
for($z=0; $z < ($number); $z++) {
$thu = $z + $start;
if ($pics[$thu] != "")
$size = getimagesize("$pics[$thu]");
echo "<img src=\"". $pics[$thu]. "\" border=1 width=\"$size[0]\" height=\"$size[1]\">";
}
echo "</td></tr>";
echo "<tr><td align='left'>";
if($start > 0)
echo "<a href=\"" . $PHP_SELF . "?start=" . ($start - 1) . "\"><img src=\"../../images/prev.gif\" border=\"0\"></a><BR>\n";
echo "</td><td align='right'>";
if($start > ($total)) {
echo "";
} else {
if($total > ($start + 1))
echo "<a href=\"" . $PHP_SELF . "?start=" . ($start + 1) . "\"><img src=\"../../images/next.gif\" border=\"0\"></a><BR>\n"; }
echo "</td></tr></table>";
?>
<body>
</html>
Suggestions would be appreciated as it has me beat.
I wrote this slideshow script for a real estate site a few years back and recently altered it slightly for a used vehicle site, worked just fine until the host upgraded the server to PHP 5.
This script resides in the same directory as the photos (up to 5). It takes the names of files beginning with "t_" (thumbnails) and puts them into an array. Then does its thing.
PHP 5 appears to be screwing up the count.
Can anyone tell me why this is so?
<html>
<head>
<style>
body { margin: 0px; }
a { font-family: arial; font-size: 12px; font-weight: normal; color: white; text-decoration: none; }
a:hover { font-face: arial; font-size: 12px; font-weight: normal; color: white; text-decoration: underline; }
</style>
</head>
<body bgcolor="#666666">
<table border="0" cellpadding="0" cellspacing="0" align="center">
<tr><td colspan="2" align="right">
<a href="javascript:window.close();"><img src="../../images/close.gif" width="105" height="18" border="0"></a></td></tr>
<tr><td colspan="2" align="center">
<?php
if(!isset($start)) $start = 0;
$pics = Array();
$number = "1";
$handle = opendir(".");
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (!strstr($file, "t_")) {
$pics[] = $file; }
}
}
closedir($handle);
$total = (count($pics) - 1);
for($z=0; $z < ($number); $z++) {
$thu = $z + $start;
if ($pics[$thu] != "")
$size = getimagesize("$pics[$thu]");
echo "<img src=\"". $pics[$thu]. "\" border=1 width=\"$size[0]\" height=\"$size[1]\">";
}
echo "</td></tr>";
echo "<tr><td align='left'>";
if($start > 0)
echo "<a href=\"" . $PHP_SELF . "?start=" . ($start - 1) . "\"><img src=\"../../images/prev.gif\" border=\"0\"></a><BR>\n";
echo "</td><td align='right'>";
if($start > ($total)) {
echo "";
} else {
if($total > ($start + 1))
echo "<a href=\"" . $PHP_SELF . "?start=" . ($start + 1) . "\"><img src=\"../../images/next.gif\" border=\"0\"></a><BR>\n"; }
echo "</td></tr></table>";
?>
<body>
</html>
Suggestions would be appreciated as it has me beat.