Gallery Script

Upgrading from an earlier version ?

Skip this step if you do not want to upgrade your current database to the new 1.3 format.

The zip file contains a script called ''.  Edit the options $database and $newdatabase to reflect the name of your current database and a name for the new database.  Add the path to the file names in case your database is not stored at the same location as where you will upload the script.  Also change the path to Perl if necessary.

Upload the script to your web server and chmod it (755 or 777).  Run it once from the browser (  It should now say 'Database is converted'.  If so, the conversion was successful and you can proceed with the other steps.

What do I need to run the script ?

  • The script (see zip file)
  • The empty database file (database.txt from the zip file)
  • Some html template files (examples provided in the zip file)
  • Your own website with FTP access
  • Permission to run CGI scripts on your server
  • Web hosting with Perl 5.006 or higher installed
  • Web hosting has the Perl GD module installed (optional)

What will I have to do ?

"Quick" and "Easy" are the keywords !

1. Make a few changes to the script options.
2. Create the templates or edit the existing ones.
3. Upload the files to your web server.
4. Testing and using...

1. Make a few changes to the script

a. Unpack the zip file.
b. Edit a few options at the start of the script using a text editor like notepad or NOTEPAD++.  The options in the script are preceded by 'my'.  Leave it in, since it's a part of the programming language.  Some of the options underneath are only available in the XTra version.

  This is correct in 99% of the cases.  Check the requirements at the top of the page if this turns out to be different for your web host.  Alternatively, you can just check with your web administrator on what the correct path is.
my $database = 'database.txt'; 
  The name of your database file.  Add the path in case you store it in another folder/directory than the script.
my $token = '@#@#@'; 
  This token tells the script where it can put its output in the admin and error template.  Only change this in case you are having this token already somewhere on your page (which I do not think will happen :-) )
my $image_dir = '/path/to/your/images'; 
  Change this to the path in which you will store the images uploaded to the gallery.
my $template_list = '/path/to/your/listtemplate.html';
my $template_view = '/path/to/your/viewtemplate.html';
my $template_slide = '/path/to/your/slidetemplate.html';
my $template_admin = '/path/to/your/template.html';
my $template_error = '/path/to/your/template.html';
  Change these to the paths and filenames of your templates.  You can use the same template for the admin and error page.
my $image_url = 'http://url/to/your/images';
  The URL to the place where the script will store the images.
my $maxfilesize = 400000; 
  To prevent abuse of the script, you can specify the maximum size of an image here.  Attempts to upload bigger files will be blocked.  The file size is in bytes.
my $login = 'user';
my $password = 'pass'; 
  The admin console is protected using a username and password login.  You can specify these here.
my $thumbsperpage = 6;
my $thumbsperadminpage = 6; 
  The number of thumbnail images per page for either the thumbnail listing pages or the admin console.
my $thumbsperrow = 2;
  The number of thumbnails that will be put next to each other in the thumbnail listing page.
my $viewtarget = "_new";
my $slidetarget = "_new"; 
  This allows you to specify where the application should open a view or slide show windows (can be a new window, the same frame, a named frame, etc...)
my $tablebackground = "#FF9900";
  You can specify the background color of the login box, the admin console tables, the input forms, etc... here.
my $dateformat = "EU";
  Tells the script how to format the date (EU or US).  So, determines whether it will show dd-mm-yyyy or mm-dd-yyyy.
my $requiretitle = 1;
  Set to 0 if specifying an image title is not mandatory.
my $server_timezone_offset = 0; 
  Your server is not always in the same time zone as your target audience.  You can specify a positive or negative offset in number of hours against the server time zone.
my $slideselectorcolour = "#FF9900";
my $entryselectorcolour = "#FF0000";
  The color of the box that will indicate the current slide in the thumbnails listing page or the recently change entry in the admin page.
my $slidetime = 7; 
  Number of seconds a slide will be shown during a slide show.
my $persistentslideselector = 0;
  Normally the slide selector only appears when you started a slide show and paused it.  With this option set to 1, the slide selector will always be shown.
my $thumb_x_pxsize = '150';
my $thumb_y_pxsize = '150'; 
  The size you want for the thumbnail images.
my $default_action = 'list'; 
  The default action if the script is called without any parameters in the URL.  You can change this to 'admin' or 'slide'.
my %WORDS =
E_TEMPLATE => "Error : template file could not be loaded",
E_NOTAUTHORISED => "You seem not to be authorized to perform this action", 
  This is the string table.  You can change the sentences and words at the right side of the arrows to reflect either your own language or style.  Did we say that you determine the looks of the application ?  ;-)

When you have done this, you can save the modified version of the script and close the editor.  If you have a UNIX web host, make sure you save the files in UNIX format.  See also the FAQ or point 3 on this page.

2. Create templates or edit the existing ones

The zip files ship with a set of templates.  The idea of using a template, is to give you full control of how the gallery will look.  You might want to use a template with the same looks as your website, to ensure that no one will even notice that it is a third party application.

The templates are normal HTML files and you can use any web page software (like e.g. frontpage or dreamweaver) to make or change them.  The only thing you have to do extra to make it work with the script, is to include some things where you want the script to put its output.

A full howto + examples on creating templates can be found here.

3. Upload the files to your web server

Now that you have edited the script options and the template(s) to your liking, you can start uploading the files to your web server.  If you have a unix server, you must make sure that the database file and the script file are in unix format.  Notepad++ (see point 1) can save directly into unix format, when using notepad, you will have to run a little tool like dos2unix.

Upload each file to the location you specified in the script options.  Then set the permission for the script file and the database file (chmod 755 or 777 on some servers).  See the FAQ for more info on CHMOD.

4. Testing and using...

Now the script should be up and running !  Do a little test and type the value of $scriptname in the address bar of your browser.  The thumbnail listing (empty of course) should display.

You can start putting links to the gallery on your site.  Suppose that you have
my $scriptname = '';

Then you can use links/URLs like :

All versions :
  Start the gallery (usually in the thumbnail overview page unless specified otherwise in the XTra script options)
  Show the galleryscript administration console
  Show the picture with ID 2.
  Show a thumbnails listing of all pictures belonging to gallery BMW.
  Show only page 2 of the thumbnail listing of all pictures belonging to gallery BMW.
  Start a slide show (will start at ID=1)
  Start a slide show of only the pictures belonging to gallery BMW
  Start a slide show of all pictures starting at picture 234
  Show a thumbnail listing of all pictures sorted chronologically in descending order.
  Show a thumbnail listing of all pictures belonging to gallery BMW, sorted alphabetically and ascending.
  A slide show of the same pictures in the same order as the previous example.
  Show an information page about the script version, whether GD is active, etc...

home | rate the scripts | community support forum |