Simple Galleries Plugin for bBlog 0.7.6

there are many different possibilities how to show photo-galleries:

1. you make HTML-entries and reference every image. this has the advantage, that you are free to design and make comments. but it is a lot of work.

2. you take images in given directories and show them. some pictures have prefixes and suffixes, which qualify them as thumbnail-previews. this is a very simple and dynamic solution. you can edit the pictures and thumbnails in batch-jobs with your favourite program, like ThumbsPlus, ACDSee, IrfanView and more in these programs you can also put IPTC-informations into the images, which can be read out later.

3. you make a database solution where you store some pictures and a lot of informations. this solution is very professional, quick in runtime and infinite scalable. the problem is, this is a very complex solution, which is fit for big platforms that host photographers work.

i took the 2. solution, because for me it is a simple way to store tons of photos and administrate them with my favourite batch-job-program. this is why this plugin is called "Simple Gallery Plugin"!

usually i upload my images with FTP, then later write a blog-entry for the new gallery. that does it for me.

this plugin provides 3 basic functions:

1. {simplegalleriesoverview} Shows a list of available galleries in a given directory and sorts them by name, size or last modification.

2. {simplegalleriesshow} Outputs an associative array containing all the images and related thumbnails in a given directory and gallery.

3. {simplegalleriesrandom} picks out a random gallery and a random image in the gallery and returns the information as an associative array.

and templates:

1. simplegalleriesoverview.html is the template that shows the overview over all available galleries.

2. simplegalleriesshow.html is the template that show the list of images.

3. simplegalleriesrandom_example.html is just a snippet showing the usage of the random image.

in the next lines i will show some example cases and give some useful hints.

lets say we have some directory containing subdirectories which include images and thumbnail-previews

/our_gallery_collection
       /gallery1
              /image001.jpg
              /image002.jpg
              /image003.jpg
              .
              .
              .
              /tn_image001.jpg
              /tn_image002.jpg
              /tn_image003.jpg
              .
              .
              .
      /gallery2
              /image001.jpg
              /image002.jpg
              /image003.jpg
              .
              .
              .
              /tn_image001.jpg
              /tn_image002.jpg
              /tn_image003.jpg
              .
              .
              .
      /gallery3
      .
      .
      .

this is a very common structure. the thumbnails are qualified by the prefix "tn_" and have no suffix. some other example for naming images:

image001.jpg
image002.jpg
image003.jpg
.
.
.
tn_image001_prev.jpg
tn_image002_prev.jpg
tn_image003_prev.jpg
.
.
.

prefix is "tn_", suffix is "_prev". so you can use a batch-program to easily create thumbnail-previews.
please be sure not to do something like this:

tn_image001.jpg
tn_tn_image001.jpg

or

image001_prev.jpg
image001_prev_prev.jpg

this will cause unwanted behaviour.
now lets see how to use the functions for our directory-structures:

{simplegalleriesoverview dir="bblog/our_gallery_collection/"}

will give you 10 results, sorted by last modification, separated by <br /> for the given directory.

{simplegalleriesoverview dir="bblog/our_gallery_collection/" num="-1"
sep="</li><li>" sort="name"}

will give you infinite results, sorted by name, separarted by </li><li> for the given directory.

{simplegalleriesshow assign="gallery" dir="bblog/our_gallery_collecti
on/"}

will assign all images and thumbnail-previews in the given directory and the choosen gallery passed by $_GET['galleryname'] to $gallery, using the prefix "tn_", no suffix and formatting the modification by strftime "%x %X".

{simplegalleriesshow assign="gallery" dir="bblog/our_gallery_collecti
on/" prefix="thumb_" suffix="_prev" strftime="%d.%m.%Y %H:%M"}

will assign all images and thumbnail-previews in the given directory and the choosen gallery passed by $_GET['galleryname'] to $gallery, using the prefix "thumb_", the suffix "_prev" and formatting the modification to a german date and time.

{simplegalleriesrandom assign="random_pic" dir="bblog/our_gallery_col
lection/"}

will assign the random image and thumbnail-preview in the given directory and a random gallery to $random_pic, using the prefix "tn_", no suffix and formatting the modification by strftime "%x %X".

{simplegalleriesrandom assign="random_pic" dir="bblog/our_gallery_col
lection/" prefix="thumb_" suffix="_prev" strftime="%d.%m.%Y %H:%M"}

will assign the random image and thumbnail-preview in the given directory and a random gallery to $random_pic, using the prefix "thumb_", the suffix "_prev" and formatting the modification to a german date and time.

more information on how to use these funtions to output useful content can be found in the templates.

one more thing to say: the system can make use of CLEANURLS.

http://www.foo.com/galleries.php?galleryname=bar_2006

will be

http://www.foo.com/galleries/bar_2006/

so please add the following to your .htaccess

RewriteRule ^galleries/([^/]+) http://www.foo.com/galleries.php?galler
yname=$1

Download

Friday, 08. September 2006 • trackback url

Add Comment

( to reply to a comment, click the reply link next to the comment )

Comment Title:
Your Name:
Email Address:
Make Public?
Website:
Make Public?

Comment:


Allowed XHTML tags : a, b, i, strong, code, acrynom, blockquote, abbr. Linebreaks will be converted automatically.


Captcha:

captcha image

Soundfile:


please type the content of the above image or the soundfile into the following form-field: