i wanted to make an image gallery showing only 40 images at a time through the highslide js plugin, all is well except when i get to the end of what the gallery should be, i get a blank page, or a page with the wrong number of images.
the images are labeled #-freebies.jpg for convenience, making the for() loop show what image is relative to what loop # its on. IE loop 30 shows image 30-freebie.jpg. to see what i am referring to look here: http://freebiespages.hostzi.com/PastPrizes.php?start=840&end=880 clicking next should display images 881 - 922 of the 951 or so images.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "xhtml11.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>weedfreebies past winners</title>
<script type="text/javascript" src="highslide/highslide-with-gallery.js"></script>
<link rel="stylesheet" type="text/css" href="highslide/highslide.css" />
<script type="text/javascript">
hs.graphicsDir = 'highslide/graphics/';
hs.align = 'center';
hs.transitions = ['expand', 'crossfade'];
hs.outlineType = 'glossy-dark';
hs.wrapperClassName = 'dark';
hs.fadeInOut = true;
hs.dimmingOpacity = 0.99;
if (hs.addSlideshow) hs.addSlideshow({
interval: 6500,
repeat: false,
useControls: true,
fixedControls: 'fit',
overlayOptions: {
opacity: .72,
position: 'bottom center',
hideOnMouseOut: true
}
});
</script>
</head>
<body>
<div class="highslide-gallery">
<?php
ini_set('display_errors',1);
include("Admin-panel/tracker/tracker.php");
$selfPost = $_SERVER['PHP_SELF'];
$path = 'images/weedfreebies/';
$saved_imgs = glob($path . "*.jpg");
if(isset($_GET['start']))
$start = $_GET['start'];
else
$start = 1;
if(isset($_GET['end'])){
$end = $_GET['end'];
if($end>count($saved_imgs))
$end = count($saved_imgs)-1;
if($end<0)
$end = 20;
}
else
$end = 40;
$nts = $start + 40;
$nte = $end + 40;
$bts = $start - 40;
$bte = $end - 40;
echo <<<EOF
<script type="text/javascript"><!--
google_ad_client = "ca-pub-8313138248138913";
/* bottom long */
google_ad_slot = "1855448750";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<br>
EOF;
echo '<div style="width:100%;heigth:100%;background: -webkit-gradient(radial, 50% 100%, 10, 50% 50%, 90, from(rgba(31,169,244,1)), to(rgba(0,28,78, 1)) );background: -moz-radial-gradient(center 80px 45deg, circle cover, rgba(31,169,244,1) 0%, rgba(0,28,78, 1) 100%);">';
for($i=$start;$i!=$end+1;$i++){
if(file_exists($path.$i."-freebie.jpg")){
$imagesize = @getimagesize($saved_imgs[$i]);
if($imagesize[3] == 'width="132" height="64"')
echo " ";
else{
$freebieslink = "http://weedfreebies.com/index.php?option=com_zoo&task=item&item_id=$i&Itemid=102";
$page = '<a href="./images/weedfreebies/'.$i.'-freebie.jpg" class="highslide" onclick="return hs.expand(this)">';
$page .= '<img src="./image.php?width=180&height=180&image=/images/weedfreebies/'.$i.'-freebie.jpg" style="margin-top: 15px" width="120" height="90" alt="Highslide JS" title="Click to enlarge" /></a>';
$page .= '<div class="highslide-caption">';
$page .= 'Weedfreebies :<a href="'.$freebieslink.'"'.$imagesize[3].' target="_blank">Prize Page</a><br>';
$page .= '</div> ';
echo $page;
}
}
if(!file_exists($path.$i."-freebie.jpg")){
$end++;
if($end>count($saved_imgs)){
$end = count($saved_imgs)-1;
}
}
}
echo '</div>';
echo '<font size="+2" color="white"><a href="PastPrizes.php?start='.$bts.'&end='.$bte.'">back</a>::::<a href="PastPrizes.php?start='.$nts.'&end='.$nte.'">next</a></font><br>';
?>