Automatically Generate a Photo Gallery
Creating a Photo Gallery isn’t such a hard task. My favorite way to present photos is simply a grid of thumbnails that people may pick and choose from as they see ones that interest them. Clicking on a thumbnail brings up a larger version. Could be a direct link to the larger photo or something fancier like a modal box. If you are creating a fairly small gallery, hand coding this grid of thumbnails is probably fine, but if you are creating a fairly large gallery or you anticipate doing a lot of adding/editing/swapping of photos, you may want to consider a better solution. And that solution is…. An automatically generating photo gallery!
When I say “Auto Generating”, I don’t mean that that it takes the pictures for you. This gallery won’t even create the thumbnails for you. What it DOES, is build itself dynamically from your directory of images. So when you want to add new photos, you simply drop the new photo and thumbnail in the directory and you are done! Removing photos just means removing the photos from the image directory. We use PHP for this web wizardry.
1. The Basic HTML Page Structure
<html script >
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Auto Generating Photo Gallery</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="page-wrap">
<img src="resources/header.png" alt="Photo Gallery" /><br />
<!-- Thumbnails go here -->
</div>
</body>
</html>
</html script >