SiGal - Simple Gallery script

It is a free photo gallery written in PHP. This script inspired by simplicity of brilliant MySQL client Adminer from Jakub Vrána. It is completely in only one file. It is very simple to upload it anywhere to hosting and use it in a few seconds. And why don't use this idea for web photo gallery?

Download How to start?


Features

*) Support for some formats depends on browser compatibility and support of HTML5 standards.


Screenshots

The selection of albums, lightbox-like preview of photo and details of photo with GPS geotag and maps.

album selection photo preview photo details with GPS and maps


Requirements

  • PHP 5.3+ with GD2 support
  • writeable directory for cache
  • very little knowledge about HTML/PHP for tuning configuration

License

Modified BSD License (http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5)

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Roadmap

Here you can see some planned features:

More on GitHub...


Documentation and how to start

Documentation of source code is here.

How to install gallery?

This is common how-to:

  1. Download last version of minified SiGal script. See above...
  2. Upload it to your server/hosting and rename it to index.php.
  3. Create writeable (for PHP) directory ./cache/.
  4. Create directory ./pictures/.
  5. Put whole directories with images into ./pictures/

That is all! Now you can access via your favorite browser to URL where is your index.php.

How to configure gallery?

If you are not happy with default configuration, you can modify it by creating file config.php in a same dir as your index.php. Here is minimal exmaple with doc:

<?php
	/** Directory with pictures. */
	$conf['dir'] = 'pictures';
	/** Directory for caching thumbnails (must be writeable!).*/
	$conf['cache'] = 'cache';
	/** URL to default album and picture icon. May be absolute or relative. */
	$conf['defaultIcon'] = '?static=defico';
	/** Name of file with definition of title image. */
	$conf['icotitlefname'] = '000.nfo';
	/** Name of file with defined usernames/passwords for locked/private albums. */
	$conf['lockfname'] = '000.lock';
	/** Width of thumbnail. */
	$conf['thumb_x'] = 160;
	/** Height of thumbnail. */
	conf['thumb_y'] = 120;
	/** Width of middle size picture - the view size. */
	$conf['middle_x'] = 800;
	/** Number of characters of shortened image title. */
	$conf['imgTitleLen'] = 16;
	/** Title of whole gallery. */
	$conf['galTitle'] = 'SiGal gallery';
	/** String shown in bottom of each page. Designed to some words about legal use of photos. */
	$conf['legal_notice'] = 'No photos can be distributted without written permission of their author (<a href="http://gimli2.gipix.net">Gimli2</a>).';
?>

Be sure, that file with usernames and passwords (default: 000.lock) is unaccessible through browser! It can be done simply by creating .htaccess file with this content:

<FilesMatch ".*\.(lock|nfo)$">
	Order Allow,Deny
	Deny from all
</FilesMatch>

For better performance set caching header in .htaccess file like this:

<FilesMatch "\.(jpg)$">
	<IfModule mod_headers.c>
		eETag None
		Header unset Last-Modified
		der unset ETag
		Header set Cache-Control "public"
		Header set Expires "Sun, 15 Oct 2023 13:04:13 +0200"
	</IfModule>
</FilesMatch>

<IfModule mod_expires.c>
	ExpiresActive On
	ExpiresDefault "access plus 1 month"
	ExpiresByType image/jpg A2592000
	ExpiresByType image/jpeg A2592000
</IfModule>

How to style gallery?

You can redefine all CSS in file ownstyle.css which should be beside your index.php.

How to set some image as title image for album?

In given album directory simply create text file 000.nfo and put the name of selected title file (eg. car.jpg) in it.

How to lock some album for some users?

In given album directory simply create text file 000.lock and put there next string without quotes: "username:password". If you want more users, add each on separate line. The duplicities in usernames are permited. In that case the user has more than one password. Warning: The passwords are NOT encrypted!

Under the hood...

Many things can be redefined or configured. Consult documentation of attributes and explore inner parts in sources. ;-)


© Gimli2