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
lostinphp
Forum Commoner
Posts: 44 Joined: Wed Jul 27, 2005 5:10 am
Location: Paris,France.
Post
by lostinphp » Thu Aug 25, 2005 2:20 am
the following code displays all the images in folder "thimg"
Code: Select all
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR">
<title>Everything Graphik Image Gallery</title>
</head>
<body bgcolor="#F0F0E8" a:hover="#6F6F69" a:linked="#6F6F69">
<center>
<br>
<br>
<table width="800" border="0">
<tr>
<td width="56%"><img src="logo.jpg"></td>
<td width="44%" align="right"><font color="#6F6F69" face="Verdana, Arial, Helvetica, sans-serif" size="-4">everything graphik, site personnel d'antoine ricardou. plus d'infos sur <a href="http://www.be-poles.com">www.be-poles.com</a></font></td>
</tr>
</table>
<p align="left"><font color="#6F6F69" face="verdana"> Month/Year <a href="#">back</a> <a href="#">next</a></font></p>
<?php
$a = '0';
$filepath = "thimg";
$url_path = "upimg";
$dir = dir($filepath);
echo "<table border=\"0\" cellpadding=\"5\" cellspacing=\"5\" width=\"75%\">";
while($entry=$dir->read())
{
if($entry == "." || $entry == "..") {
continue;
}
$fp = @fopen("$filepath/$entry","r");
if ($a == '1') {echo "<tr>";}
if ($a == '11') {echo "<tr>";}
if ($a == '21') {echo "<tr>";}
if ($a == '31') {echo "<tr>";}
?><br>
</center>
<div align="center">
<center>
<td width="40"><a href="display.php"><img src='<? print"$filepath/$entry" ?>' alt="<? echo $entry ?>"></a></td>
<? $a = ($a + 1);
}
?>
</tr>
</table></center>
</div>
</body>
</html>
the next one display.php is supposed to show only the particular large image when clicked on its thumbnail.instead displays all the images in "upimg" folder..which is fair cos the codes say so too..now i know i have to pass some parameters so dat it displays only one image at a time when clicked on its thumbnail..how do i do it? i mean i dont get the very concept of passing parameters..i looked up on the net..but the explanations are very vague..
Code: Select all
<?php
$url_path = "upimg";
$dir = dir($url_path);
while($entry=$dir->read())
{
if($entry == "." || $entry == "..") {
continue;
}
//$fp = @fopen("$url_path/$entry","r");
?>
<center>
<a href="image.php"><img src='<? echo"$url_path/$entry"?>' alt="<? echo $entry ?>"></a>
<?
}
?>
</center>
can anyone here please explain wat i ought to be doing?
thank u
Last edited by
lostinphp on Thu Aug 25, 2005 9:03 am, edited 1 time in total.
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Thu Aug 25, 2005 2:54 am
put the parameter in this line in your first script.
Code: Select all
<td width="40"><a href="display.php?img=$entry"><img src='<? print"$filepath/$entry" ?>' alt="<? echo $entry ?>"></a></td>
then in your display script, someting simple like.
Code: Select all
$imagename = $_GET['img'];
$url_path = "upimg";
echo "<center>";
echo "<a href=\"image.php\"><img src=\"$url_path/$entry\"></a> ";
echo "</center>";
lostinphp
Forum Commoner
Posts: 44 Joined: Wed Jul 27, 2005 5:10 am
Location: Paris,France.
Post
by lostinphp » Thu Aug 25, 2005 3:39 am
made the modifications
still not working
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Thu Aug 25, 2005 3:44 am
lostinphp wrote: still not working
...Doesn't help me help you
lostinphp
Forum Commoner
Posts: 44 Joined: Wed Jul 27, 2005 5:10 am
Location: Paris,France.
Post
by lostinphp » Thu Aug 25, 2005 3:57 am
i made the modifications and its still acting the same way!
looks like it has a mind of its own!
thanks a lot though!
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Aug 25, 2005 7:53 am
might want something like this more:
Code: Select all
$imagename = $_GET['img'];
$url_path = "upimg";
echo "<center>";
echo "<a href=\"image.php\"><img src=\"$url_path/$imagename\"></a> ";
echo "</center>";
lostinphp
Forum Commoner
Posts: 44 Joined: Wed Jul 27, 2005 5:10 am
Location: Paris,France.
Post
by lostinphp » Thu Aug 25, 2005 8:15 am
of course i did.
lostinphp
Forum Commoner
Posts: 44 Joined: Wed Jul 27, 2005 5:10 am
Location: Paris,France.
Post
by lostinphp » Thu Aug 25, 2005 9:03 am
works!!!
thanks for the suggestions!