image gallery help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hlz123
Forum Newbie
Posts: 1
Joined: Thu Apr 13, 2006 8:10 pm

image gallery help

Post by hlz123 »

I've recently taken over a website which contains a photo gallery and I was told the photo gallery used to work in a way that if you clicked on a photo it would open a larger version of the photo in a pop up window, and I've been asked to fix it so it works that way again. The code is as follows

Code: Select all

<?php

	echo "&begin=1";
	
	$mydir = "photos/"; 
	$d = dir($mydir);
	$fileString = "";
	
	while($entry = $d->read()) {
		if ($entry!= "." && $entry!= "..") {
			$fileString .= $entry.",";
		}
	}
	$fileString = substr($fileString,0,strlen($fileString));
	
	$fileArray = explode(",",$fileString);
	sort($fileArray);
	



	$photoCount = 0;

	for ($i=0; $i < count($fileArray); $i++) {
		if (strlen($fileArray[$i]) != "") {
			$photoCount++;
			echo "&photolink".$photoCount."=".$mydir.$fileArray[$i];



		echo "&photofile".$photoCount."=image.php?w=70%26h=70%26image=".$mydir.$fileArray[$i];
			

//echo "<td align=\"center\"><a href=\"javascript:PopupPic('".$mydir.$fileArray[$i]."');\"><img src=\"image.php?w=100&h=100&image=".$mydir.$fileArray[$i]."\" border=\"0\"></a></td>";
	




		}
	}
	
	        echo  "&numphotos=".$photoCount;   


	$d->close();
	
	echo "&end=1";

?>
I assumed the part that was commented out is the part that would make the photos open in the popup window but if I include that, none of the photos will show up at all. Any help would be great
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it would appear the code is now created such that it generates a single large URL. :?
Post Reply