Gallery Customization
Many people have asked me how I customized my photo gallery to look the way it does. Especially the multi-column layout of my main album page. I have been loath to publish it, since I like having a unique site and I am also not keen on supporting it. But I decided to publish it in any case.
DISCLAIMER
I am using Gallery
v1.5 (I know G2 is out, but I like the file-based v1.5). The
instructions are only guidelines and require php scripting knowledge,
since you will be hacking into the Gallery code. It is probably not
bug-free and I paid little attention to modifying features that I don't
use (like the statistics pages, the comments features, or the voting
features).
[full zip of my gallery folder]
Here is my full gallery directory (including config.php and the frommel skin). Feel free to use it as you wish. Or you could just keep these files for reference and use it to roll your own version of Gallery. Here are the steps (roughly) that I took to make the standard Gallery 1.5 into my version:
1. Installed Gallery 1.5
I had some problems getting Gallery to work on my XP system, and had to do the following:- Created config.php, and ran the following permission command in the gallery directory:
cacls config.php /E /G COBUS_T42IUSR_COBUS_T42:W - Also had to set permissions of the albums directory (called albums_frommel in my case):
cacls albums_frommel /T /E /G COBUS_T42IUSR_COBUS_T42:C - Install the frommel skin (included in the zip file).
2. Configuration
You can look at the config.php in the zip file, but, in general my settings are as follows:| General Settings | Text Only Pick the frommel skin |
| Main Gallery Page | No tree Highlight Size 200 Show Owner No Albums per page 12 Search Engine No Frame Around Albums: Solid |
| Comments | Indicate: Off |
| Layout | Columns 9 Rows 4 |
| Appearance | Border: white |
| Image Processing | Tumbnail size 75 Resized Image 700 Fit to window: No Visitor size pref: No |
| Frames | Solid |
3. Some Design Facts
Album thumbnails (highlights) are 248x78. Instead of using the normal thumbnails as highlights for albums, I create 2 files in each album directory, tn_banner.jpg and banner.jpg. I changed the code on the site so that these images can be made automatically on the site by the ‘highlight’ feature (modified the core gallery files as described below). Also, when uploading, I automatically create square thumbnails for the images (modified the core gallery files as described below).4. Album List Page
| Albums.php | Added a template callout… and a new template called albums.table.tpl Moved the admin box to the bottom |
| Classes\album.php | Changed the function getHighlightTag to show the new album highlight thumbnails |
| util.php | Changed the doctype in the funtion doctype() to XHTML 1.0 instead of HTML 4.01 Changed acceptableMovieList() to include wma and mp3 |
5. View_Album Page
| View_album.php | Moved the admin box to the bottom Commented out the navigation and breadcrumb code (line 470-ish) Comment out summary, since that is taken care of in album.header.tpl Some major work with the image grid table starting line 700. Need to handle albums differently, because an album thumbnail spans 3 columns, and you have to manage when you create a new row in the grid. |
6. Creating Album highlights and banners
| View_album.php | Changed the highlight function to call edit_highlight.php, a new file |
| Edit_highlight.php | New file called from view_album.php to select the highlight area for the banner and album thumbnail |
| Classes\AlbumItem.php | Modified the function makeThumbnail to automatically make a square thumbnail on upload. Created a new function called makeBannerThumbnail to make the large and banner images for the album highlights. |