Images are resized automatically (configurable) and thumbnails are created on-the-fly only once, after that all requests are made directlyto the saved images, minimizing the server load and page load speed.
Put the content of public/ directory to the image gallery in a public location on your server and the content of library/ outside the public folder.
/home/SimpleGallery/library/ SimpleGallery/ /home/public_html/YourGallery/ ImagesFolder1/ ImagesFolder2/ index.php config.php style.css .htaccess
Please note that although you can have as many image galleries as you want, they need to be stored in a public location (accesible through the browser). Don't worry, direct browsing of the folders is disabled using the provided .htaccess file.
Upload images in the public directory using FTP (or other method of your choice).
To configure PHP SimpleGallery you just need to edit the provided config.php file.
The source directory is the path to the image gallery. If you copied the config.php directly to the image gallery root there is no need to change this. You can however alter this value if you have a custom setup (not recommended).
/** * Full path to the images source directory */ 'source_directory' => dirname(__FILE__),
The public url value must point to the public http location of your gallery.
/** * Public url for the gallery */ 'public_url' => 'http://localhost/TestGallery/',
Image thumbnails will be created in a directory, the name of this directory can be customized (usually you can leave this value default).
/** * Thumbnails directory name */ 'thumbnail_directory' => 'thumbnails',
Customize your gallery name.
/** * The gallery name */ 'gallery_name' => 'SimpleGallery',
The script supports automatic image resize. Please be careful with this value since the operation will resize the images WITHOUT ANY BACKUP! If you do not want your images altered just set this parameter to false.
/** * Automaticaly resize images * * WARNING! This will resize ORIGINAL images, no backup is made! */ 'auto_resize' => true, /** * Maximum image width * * NOTE: Only used when auto_resize is set to true */ 'max_width' => 800, /** * Maximum image height * * NOTE: Only used when auto_resize is set to true */ 'max_height' => 600,
You can customize the width and height of the thumbnails (normally you can leave these default).
/** * Thumbnail width */ 'thumbnail_width' => 100, /** * Thumbnail height */ 'thumbnail_height' => 100,
If you want you can customize the values of accepted file extensions (separated by comma).
/** * The accepted file extensions */ 'file_extensions' => 'jpeg,jpg,gif,png',
By default an image count for each gallery is displayed. You can turn this off for a small performance improvement or if you don't want to display the number of images in each gallery.
/** * Display image count for each gallery */ 'count_images' => true,
When each image is viewed a number of thumbnails are displayed in the navigation bar before and after the current one. You can customize this value if you want (usually you can leave this default).
/** * Maximum number of images to show before and after the current one */ 'max_nav_images_around' => 2
To view all of the available class methods take a look at the API reference.
If you are looking for a demo of the PHP Simple Gallery script you can find here a fully working gallery.