PHP Thumbnails on the Fly

In the MegaGallery project, we used the EXIF library in PHP to extract the thumbnails from the image itself. However, what do we do if we do not have EXIF installed or available through our web server provider? One possibility is to use the GD library. The GD library will allow us to create a thumbnail using the image itself. Continue reading


PHP XTemplate: Import Files

In the previous two tutorials on XTemplate, I discussed the basics of tag assignment and dealing with dynamic blocks, but the real power of using a templating system comes when you are able to use the same basic layout template on more than one page while displaying different content. XTemplate allows us to import template files into an existing template, allowing us to maintain a site structure on each page, but the true power comes when we need to make changes to the layout. Edit one file and the changes go into effect for all the pages using that template. Continue reading

Reading XML with PHP, The XML Document

I have found many situations where being able to read the information in a XML/RSS file has come in handy. For example, putting a block on a page with the latest entries from a blog. Since XML files are basically structured flat databases, I use them sometimes for short collections that do not require security.

XML files are not difficult. You don’t need a fancy, expensive program to generate them, and PHP has functions built in to read and manipulate them. Continue reading

MegaGallery, Part 6: Pagination with PHP

Pagination, for our purpose here, is the system of numbering pages. With a very large gallery, you will want to break it down into page size elements to keep the viewer from having to scroll through a long, single page of images. We will do this with PHP in order for it to work even when javascript is disabled. Continue reading

MegaGallery, Part 5: Customization

So far, we have a pretty nice looking photo gallery, but if you will remember in my introduction to this project, I wanted to create a gallery model that was reusable and easy to implement. In this post, we will take our first steps toward easy customization of our gallery. Continue reading