Pedro Posada | PHP photo gallery

PHP photo gallery

Posted on March 6, 2008 - 10:07pm
<< 48 of 50 >>

This is a quick and dirty php script that generates a web picture gallery.

There is no need for a database because it recursively scans the directory tree and outputs all the images inside a n html table. It generates a navigation menu to switch between galleries as well.

It's a good solution if you deal with big amounts of pictures because you can just use FTP to upload the pictures and the script generates the thumbnails and galleries automatically.
directory structure php-gallery
You could also insert the script in your page through an include php tag and customize the look of it by modifying the css style sheet.

The idea is that you add folders inside gallery/images to create more picture galleries. In this example I created a category called Arts and I placed the City and No-flash galleries inside of it.

This gallery is just a coding exercise to get a whole picture gallery work from one php script and no use of databses. The advantages of this solution are the speed and the simplicity of it. Although the code is not very clean, the gallery work pretty well.

There is a lot of room for improvement, this is just the ferst version of a little project.

The picture on the right is a sample of how the directory structure should look like when you install the PHP gallery:

 

You are more than welcome to try it, you can download it from the link on the bottom of the page.

 

Installation:

  1. Download the compressed package
  2. Extract it on your public_html folder
  3. Make the yoursite.com/sample-gallery/cache/images direcotry writable, set its permissions to 777
  4. Upload your pictures to yoursite.com/sample-gallery/images/your-category/your-gallery
  5. Never change the names of the folders written here in bold.

System requirements:

  1. PHP 4.x or newer

 

 

AttachmentSize
sample-gallery.rar416.3 KB

Post new comment

The content of this field is kept private and will not be shown publicly.
Please solve the math question. This way we will know you are not a robot.