The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
It displays images from a designated directory in a gallery format. Thumbnails of images are created automatically and cached for future use. There is also some simple support for providing titles and descriptions of the images in a text file.
Demos: Demo1 Demo2
Code (as a text file): source code
Formatted Code (for browsing online only) : source code
# HOW TO USE THIS PHP GALLERY #
- First of all you'll need some pictures, this gallery supports gif, jpeg and png file formats.
- Upload your images to an appropriate folder on your hosting. Within that folder you need to created a directory called thumbs where the thumbnails will be stored. After you have created the thumbs folder you need to change its permissions (ie CHMOD it) so that the PHP script is allowed to write into it. The permissions you need are 755. However depending on your host you might need 777 instead.
- Image descriptions can be placed in a text file called descriptions.txt and uploaded to the thumbs folder you created. To add a description you should place a line in your text file like this..
Image file
eg..
mypicture.jpg My Picture This is a description of my picture.
You should place 1 description per line.
- Next we can configure the gallery script itself...
- Grab the script from here and save it with a php file extension.
-Add your own HTML
Replace and with your own HTML (eg your site navigation/frame etc.)
-The CSS the gallery uses is also in gallery.php. Either move it to a separate css file or place it in the head tag of your HTML frame. There are only a few styles applied, of course you can add to this as you see fit to get the style you want.
-Next you need to configure, all the config variables are clearly marked near the top of the code.
-Path to your images:
$galleryDirectory='my/absolute/path/goes/here'; You need to change my/absolute/path/goes/here to point to the directory that will contain the pictures that will be displayed in the gallery. For instance if you created a folder called gallery in your root directory then you'd simply change the path to gallery. Or if within that gallery folder you created a folder called my_first_gallery, then your path would be 'gallery/my_first_gallery'. Note you dont need a leading /.
-Thumbnail size.
Directly below the gallery path are 2 variables that define the thumbnail sizes.
$maxWidth=100;
$maxHeight=100;100 is the height and width in pixels the thumbnails will be. Change these as you see fit, but remember to update the height and widths defined in the css styles.
-Thumbnail style
$fixedSize=true;This can be set to either true or false. If set to true then the thumbnail are of a fixed size. Any resized images that are smaller than the thumbnail dimensions are then centred within that area. You can see both effects in the demos. Demo 1 shows the gallery with $fixedsize=false and demo 2 shows it with true.
-Background colour (this is only applicable if fixedSize is set to true)
$backgroundColour='000000'; dictates the background colour of the thumbnail. It is a standard html RGB hexidecimal value eg CD65A0, AABBFF. This is the colour thats shown when the thumbnail doesnt cover the entire area of the fixed size thumbnail. Tada! Hopefully you have a working gallery.
I'm not the greatest at writing descriptions but hopefully you've been able to follow it. If theres any bugs in the code, I definitely did it on purpose. :P
With a bit of basic knowledge its fairly easy to extend this as well. You can integrate it with something like lightbox or thickbox quite simply for instance.
It displays images from a designated directory in a gallery format. Thumbnails of images are created automatically and cached for future use. There is also some simple support for providing titles and descriptions of the images in a text file.
Demos: Demo1 Demo2
Code (as a text file): source code
Formatted Code (for browsing online only) : source code
# HOW TO USE THIS PHP GALLERY #
- First of all you'll need some pictures, this gallery supports gif, jpeg and png file formats.
- Upload your images to an appropriate folder on your hosting. Within that folder you need to created a directory called thumbs where the thumbnails will be stored. After you have created the thumbs folder you need to change its permissions (ie CHMOD it) so that the PHP script is allowed to write into it. The permissions you need are 755. However depending on your host you might need 777 instead.
- Image descriptions can be placed in a text file called descriptions.txt and uploaded to the thumbs folder you created. To add a description you should place a line in your text file like this..
Image file
eg..
mypicture.jpg My Picture This is a description of my picture.
You should place 1 description per line.
- Next we can configure the gallery script itself...
- Grab the script from here and save it with a php file extension.
-Add your own HTML
Replace and with your own HTML (eg your site navigation/frame etc.)
-The CSS the gallery uses is also in gallery.php. Either move it to a separate css file or place it in the head tag of your HTML frame. There are only a few styles applied, of course you can add to this as you see fit to get the style you want.
-Next you need to configure, all the config variables are clearly marked near the top of the code.
-Path to your images:
$galleryDirectory='my/absolute/path/goes/here'; You need to change my/absolute/path/goes/here to point to the directory that will contain the pictures that will be displayed in the gallery. For instance if you created a folder called gallery in your root directory then you'd simply change the path to gallery. Or if within that gallery folder you created a folder called my_first_gallery, then your path would be 'gallery/my_first_gallery'. Note you dont need a leading /.
-Thumbnail size.
Directly below the gallery path are 2 variables that define the thumbnail sizes.
$maxWidth=100;
$maxHeight=100;100 is the height and width in pixels the thumbnails will be. Change these as you see fit, but remember to update the height and widths defined in the css styles.
-Thumbnail style
$fixedSize=true;This can be set to either true or false. If set to true then the thumbnail are of a fixed size. Any resized images that are smaller than the thumbnail dimensions are then centred within that area. You can see both effects in the demos. Demo 1 shows the gallery with $fixedsize=false and demo 2 shows it with true.
-Background colour (this is only applicable if fixedSize is set to true)
$backgroundColour='000000'; dictates the background colour of the thumbnail. It is a standard html RGB hexidecimal value eg CD65A0, AABBFF. This is the colour thats shown when the thumbnail doesnt cover the entire area of the fixed size thumbnail. Tada! Hopefully you have a working gallery.
I'm not the greatest at writing descriptions but hopefully you've been able to follow it. If theres any bugs in the code, I definitely did it on purpose. :P
With a bit of basic knowledge its fairly easy to extend this as well. You can integrate it with something like lightbox or thickbox quite simply for instance.