Hello.
I'm going to show you how to make a basic php image gallery.
Firstly, create the following files

  • index.php
  • view.php
  • /images (dir)

Now, for the code.
index.php

<?php
$img = array();
$img[] = array('title'=>'img1', 'src' = 'img1.jpg');
?>
<html>
<head>
<title>mygallery | homepage</title>
</head>
<body>
<h2>mygallery</h2>
<?php
for($i = 0;$i <= count($img);$i++;) {
echo '<div class="slide">';
echo '<a href="slide.php?id='.$img[$i]['src'].'&title='.$img[$i]['title'].'" target="_blank">';
echo '<span style="font-size:15pt">'.$img[$i]['title'].'</span><img src="images/'.$img[$i]['src'].'" width="100" height="100" />';
echo '</a>';
echo '</div>';
}
?>
</body>
</html>

slide.php

<html>
<head>
<title>mygallery : viewing <?php echo $_GET['title']; ?></title>
</head>
<body>
<h2><?php echo $_GET['title']; ?></h2>
<img src="images/<?php echo $_GET['src']; ?>" />
</body>
</html>

Sorry, view.php is meant to be slide.php

It would be more helpful to others, if you'd include some more information on how and why you do things, instead of just showing code.

It would also be helpful if the $img array is filled with all files from your images folder. You can do this easily with glob.

Ok, I'll remember that for next time.