Quantcast
Channel: Dallas Clark - Web Developer, Facebook Developer, iPhone Developer, iPad Developer » script
Viewing all articles
Browse latest Browse all 12

PHP Script: Create a Photo Gallery with Thumbnails and Resized Images

$
0
0

If you want to create an easy photo gallery, this script will allow you to resize images on the fly. It has a few pros and cons that you should be aware of before you start using it.

Pros
* Simple and easy to use :) - even I can use it.
* It resizes on the fly, so you can modify the code and it will affect all images you pass through it immediately. Great if you're short on storage on your web server, and doesn't require you to re-render all the images if you decide to change the size of the thumbnails.
* You can call this script for any image on your site, the image doesn't have to sit in an actual photo gallery.

Cons
* If you have a high traffic website, this isn't the best solution. You're best off resizing all your images when they're uploaded, not when they're are viewed. If you choose to use this script on a high traffic website, then at least cache the results so your web server isn't creating the same image 1000's of times over.
* This script only works with JPEGs, I'll create a new version (one day) to handle others.
* If you think of more cons, let me know.

The GalleryViewer Script: Download (Right Click > Save Target/Link As)
* Rename the file to galleryviewer.php.

Usage
Create Thumbnail: galleryViewer.php?version=thumb&image=the/url/to/the/image.jpg
Create Resized Image: galleryViewer.php?version=full&image=the/url/to/the/image.jpg

  1. <img src="galleryViewer.php?version=thumb
  2. &image=the/url/to/the/image.jpg" alt="Thumbnail" />

Full Usage

The query string 'image' needs to be relative to the script.


Viewing all articles
Browse latest Browse all 12

Trending Articles