PHP Thumbnail Image Gallery..
PHP Thumbnail Image Gallery..
com
http://www.ricocheting.com/code/php/thumbnail-image-gallery
Home
Javascripts
PHP Scripts
Apache on Windows
Login
PHP Scripts
PHP MySQL Wrapper PHP MySQL Wrapper v3 Simple Login PHP Image Gallery
Example
Sample photo gallery using this script.
Download
gallery.zip
Terms of Use
Version 1.2.0 and onward is released under GNU General Public License. Basically this means you are free to use the script, modify it, and even redistribute versions of your own under the same license.
What's new
1.2.1 [January 13, 2008] - Code went through another cleanup and comment updates. Goal is to make it so anyone can easily modify it themselves. 1.2.0 [December 26, 2007] 1. Stripped out broken Imagemagick support. 2. Cleaned up the code. 3. Better commented everything. 4. Redid the gallery layout to use CSS the user can easily change. 5. Changed the License to GNU General Public License. 1.1.0 [June 2, 2006] - Started cleaning up the code. This version was never publicly released 1.01 [May 11, 2004] - Initial release
Instructions
gallery.php settings
Open gallery.php and scroll down to about line 30 and look for $config['size'] . Set this to the maximum width or height you want your image thumbnail to be. On the next line in the $config['imagequality'] set this to the JPEG quality you would like your thumbnails to be. I recommend you
1 of 2
11/2/2010 4:16 PM
http://www.ricocheting.com/code/php/thumbnail-image-gallery
keep it set to 70 $config['rows'] and $config['cols'] are the number of rows and number of columns of thumbnail images you want shown on each page $config['maxShow'] is the number of page numbers to show at one time. for instance if you have 100 pages of images, you can set this to only show the page numbers of the 10 pages close to where you currently are $config['fulls'] is the relative path to the full size images located on your server. Include the trailing slash. example: $config['fulls'] = "photos/"; $config['thumbs'] is the relative path to where you want the thumbnail images to be stored. Include the trailing slash.
File Permissions
You'll need to change the permission on the directory you set $config['thumbs'] to. CHMOD it to 775 or 777 so PHP and GD2 can automatically write and create your thumbnails in that directory.
Lightbox
Lightbox Support (OPTIONAL)
I've had multiple people want to know how to make this gallery work with the Lighbox script or telling me that they modified it (which is great!) themselves. While the above gallery script does not come with Lightbox support, modifing it to work with Lightbox requires very minor changes. In gallery.php edit line 116 to add rel="lightbox" so it becomes echo '<a href="'. $config['fulls'].$imagelist[$i] .'" title="'. $imagelist[$i] .'" rel="lightbox" target="_blank">'; Go down to about line 353 and include lightbox.js and its CSS in the page header (it's normal HTML down there).
PHP
2 of 2
11/2/2010 4:16 PM