Gallery Thingie Manual

  1. Introduction
  2. License Information
  3. Installing Gallery Thingie
  4. Setting up Gallery Thingie
    1. Files needed — Files explained
  5. Administrating your images
    1. Adding images
    2. Editing images
    3. Handling categories
  6. Making your public gallery
    1. Displaying an image, title and description
    2. Displaying title and description
    3. Displaying the name of a category
    4. Next and previous links
    5. Displaying links for next and previous category
    6. Displaying a list of images
    7. Displaying a list of categories
    8. Displaying a random image
  7. Appendix: Resources
  8. Appendix: Changes from earlier versions
    1. Changelog from version 1.1 to 1.2
    2. Changelog from version 1.0 to 1.1
    3. Changelog from version 0.9 to 1.0

Introduction

Gallery Thingie is a quick gallery with a quick introduction. Gallery Thingie allows you to create and maintain a small database of images and provides an easy way of integrating this on a website.

The most recent version of Gallery Thingie is always available at http://www.solitude.dk/gallerythingie/. If you have comments, tips or just want to share your gallery with me don't hesitate to contact me.

License Information

Gallery Thingie is licensed under the Creative Commons Attribution-NoDerivs-NonCommercial license. In short that means that you cannot distribute derrivative works, and you cannot use Gallery Thingie for commercial purposes. Please take time to read the full license. If you want to use Gallery Thingie for a commercial work please contact me. The price of a commercial license is $15 US.

Installing Gallery Thingie

After you have set up Gallery Thingie as explained below all you need to do is to upload the files to your webspace and CHMOD the directory where you want to store the images to 777. You should also CHMOD the XML data file to 666.

Setting up Gallery Thingie

I have tried to make it as easy as possible to get Gallery Thingie working. At the top of the gt-pub.php file you will find a section where you can change the configuration. The options are as follows.

$username = "USERNAME";
The username you want to use. Change USERNAME to your choice of username.
$password = "PASSWORD";
The password you want to use. Change PASSWORD to your choice of password.
$path = "images/";
The path to the directory where your images are located. It is relative to the gallerythingie.php and you gallery files. It must end with a slash!
$xmlfile = "gt-data.xml";
The path to the XML data file. It is relative to the gallerythingie.php and you gallery files.
$phpfile = "./";
This is the file used in links. It is what is inserted in the <a href=" tags. It should point to your gallery file.
$maxsize = 2000000;
The maximum size for files when uploading images. Size is given in bytes.
$limit = 100;
The number of characters from the image descriptions displayed when viewing the list of images in the administration. It has no effect on the displayDescription() function
$allowedfiles = array("jpg", "gif", "png");
A list of the types of images allowed for upload.
$enableThumbnails = FALSE;
Determines whether automatic creation of thumbnails should be enabled. Set to TRUE if you want to enable thumbnails.
$thumbnailwidth = 150;
This is the width of generated thumbnails in either pixels or percent. Eg. 25%. Height will be calculated accordingly.
$thumbnailquality = 100;
This is the quality of thumbnails — it only applies to jpg images. 100 is the highest, 0 is the lowest.

Files needed — Files explained

Gallery Thingie requires a couple of files to work.

gt-pub.php
This file includes the setup information. It also contains all functions related to your public gallery and the XML-functions needed by both the public gallery and the administration. If you rename or move this file you need to change the first line in gt-admin.php to reflect this.
gt-admin.php
The file that handles the administration of your gallery.
The XML data file
The database of images with titles, descriptions and category information. By default this is called gt-data.xml.
Your gallery file
In order for you to show your gallery to the public you can either integrate the gallery into your existing website or you can use a designated file. “Your gallery file” simply refers to the page which handles this. There is a sample gallery file supplied with Gallery Thingie called gallery.php.

Administrating your images

In order to handle the administration of your images you need to point your webbrowser to the location of the gt-admin.php file. If you have renamed this file you should of course go to the new location. A screen requesting your username and password will appear.

When you have logged in you will be taken to a list of the images in the database. The list contains different links: The links under “Title” links will take you to your gallery file and display the particular image. The links under “Category” will take you to your gallery file and display that particular category. The links under “File name” will take you directly to the image file. Finally the “edit” and “del” links will let you either edit or delete that image.

If you have enabled thumbnails you will see a dagger (†) next to the titles of images which does not have a thumbnail.

Adding images

By choosing the “add image” link at the top you will be taken to the page that lets you add an image to the database.

Only the “Title” and “File” fields are required, but note that if you don't choose a category the image will be added to the first category in the list. There are two ways to add an image file. First you can upload an image by choosing one from your own computer. The second method is to “link to file” — here you simply write the file name of a file that already exists in your image folder. This is useful if you want to upload a large amount of images through your FTP-program and then later add them to your gallery.

Clicking the “Add Image” button will add the image and return you to the same page so you can quickly add another image. Clicking the “Add & Exit” button will add the image and return you to the list of images.

Editing images

The edit screen looks like the add image screen. The only differences are that the “File” field is removed and that there is a new field for “Id”.

By changing the “Id” field you can move an image up and down in the list. When you submit the changes the image will get get the position of the new id.

Handling categories

By choosing “categories” from the top menu you will be taken to the screen where you can handle the categories. There is a list of categories and you can rename each category by changing the text.

You can add a category by typing something in the empty field at the bottom.

Categories are deleted by deleting the text in the input fields. Note that all categories below the category being deleted will be moved up and any images in those categories will be linked to the wrong category!

Making your public gallery

With all that taken care of you can make a gallery page. A sample gallery file is provided with Gallery Thingie, but you can incorporate Gallery Thingie on any page.

When incorporating Gallery Thingie on another page the only thing you have to do is to include the line <?php require_once("gt-pub.php");?> at the very top of the file.

Whenever you are including any of the following functions on the page it is important to remember to enclose them in PHP tags. The format is: <?php nameOfFunction();?> where nameOfFunction is the name of the function you wish to include. NB! All functions require something between the parantheses.

Displaying an image

Display images are handled by displayImage()

This function take two arguments between the parantheses, the last is optional. The first argument is the id of the image. Set it to $id to display the image the visitor requests or set it to a specific number to display that image always. The second can take two values: “full” or “thumbnail”. “Full” shows the original image, “thumbnail” shows the thumbnail of that image.

Examples: <?php displayImage($id);?> <?php displayImage("5");?> <?php displayImage($id, "thumbnail");?>

The first is what you most often wants. The second example always displays the title of the image with id 5.

Displaying title and description

Displaying titles and descriptions are handled by displayTitle() and displayDescription()

These functions both take one argument between the parantheses which is the id of the image. Set it to $id to display the image the visitor requests or set it to a specific number to display that title or description always.

Examples: <?php displayDescription($id);?> <?php displayTitle("5");?>

Displaying the name of a category

Displaying the name of a category is done with the displayCategory() function. It takes one argument which is the category id number. Leave it as $category to display the name of the current category.

Examples: <?php displayCategory($category);?> <?php displayCategory("3");?>

Next and previous links

Displaying the next and previous links are done with the displayNextLink() and displayPrevLink() functions. They take each take three arguments. The first is the id number to base the link off. Leave it as $id to base it off the current image. The second is the file name to use in the link. Leave it as $phpfile to use the file name you have specified in in the setup. The last is the text you want to use in the link.

Examples: <?php displayNextLink($id, $phpfile, "Next »");?> <?php displayPrevLink($id, "otherfile.php", "« Previous image");?>

Displaying links for next and previous category

Displaying links to the next and previous category are done with displayNextCategory() and displayPrevCategory() respectively. They both take three arguments. The first is the category to base the link off (leave it as $category to base it off the current category). The second is the file name to use in the link. Leave it as $phpfile to use the file name you have specified in in the setup. The last is the text you want to use in the link.

Examples: <?php displayNextCategory($category, $phpfile, "Next category");?> <?php displayPrevCategory($category, "otherfile.php", "« Previous category");?>

Displaying a list of images

You probably want a long list of numbers with links to each image. This is done with displayList(). The function takes two arguments. The first is the file name to use in the link. Leave it as $phpfile to use the file name you have specified in in the setup. The second is optional and can have three values: “number”, “title” and “thumbnail” — the default is “number”. If set to number the text of the links will simply be a number. If set to “title” the link text will be the title of the images. If set to “thumbnail” the link will be a thumbnail of the full image. If there is no thumbnail the title will be used instead.

By default this function will output a list of all images, unless the visitor is in a category. In that case it will only output links to images in that category. Since displayList() only outputs the individual list items (<li> elements) you need to put the <ol></ol> around the function yourself!

Examples: <ol><?php displayList($phpfile);?></ol> <ol><?php displayList($phpfile, "title");?></ol> <ol><?php displayList($phpfile, "number");?></ol> <ol><?php displayList($phpfile, "thumbnail");?></ol>

Displaying a list of categories

To display a list of categories you use displayCategories(). The function takes one argument which is the file name to use in the link. Leave it as $phpfile to use the file name you have specified in in the setup. The number of images in each category is shown after the category title.

As with the list of images only list items are outputtet so you have to remember the <ol></ol> around the function.

Example: <ol><?php displayCategories($phpfile);?></ol>

You might want to add a link to all photos at the end of the list of categories: <ol> <?php displayCategories($phpfile);?> <li><a href="<?php echo $phpfile;?>">All photos (<?php echo count($name);?>)</a></li> </ol>

Displaying a random image

Displaying a random image is handled by displayRandomImage(). All random images are also links — usually to your gallery.

This function take two arguments between the parantheses. The first is a the file that the link will point to. Leave it at $phpfile to have it point to your gallery. The other argument can have two values: “Full” or “thumbnail”. “Full” shows the original image, “thumbnail” shows the thumbnail of that image.

Examples: <?php displayRandomImage($phpfile);?> <?php displayRandomImage($phpfile, "thumbnail");?>

Appendix: Ressources

If you haven't already you might want to read up a bit on how to alter HTML lists using CSS. Removing the bullets and making them inline (so they don't skip to the next line with every item) is probably something you'd like to do. There's a really good article at AListApart about taming lists — you won't regret reading it!

In addition to that Max Design have many examples ready for copy and paste at listamatic.

Changes from earlier versions

Changelog from version 1.1 to 1.2

Changelog from version 1.0 to 1.1

Changelog from version 0.9 to 1.0