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.
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.
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.
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
to your choice of username.PASSWORD
to your choice of password.<a href="
tags. It should point to your gallery file.TRUE
if you want to enable thumbnails.25%
. Height will be calculated accordingly.Gallery Thingie requires a couple of files to work.
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.
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.
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.
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!
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.
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 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 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");?>
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 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");?>
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>
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 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");?>
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.