#57: Photoblog Gallery Plugin for WPMU
Finally, I finish my own photoblog gallery plugin for Wordpress MU. What will we get after installing this plugin? We will be able to display the page in a thumbnail format, just like photo gallery. The display will become normal in a single post condition or in admin mode. The advantage of this method is : we still can use all of available theme without any modification needed.
* This plugin is tested under WPMU 2.6.2 only *
Download this file (right click, Save As … rename it to photoblog_gallery.zip), and then extract it. Copy photob_gallery.php into your plugins directory, and plugopt.php into the mu-plugins directory. Yes, there are two plugins : one is the photoblog gallery and the other is plugin options. Plugin Options plugin (sorry for the name), will give us an additional [Plugins Options] sub-menu under Plugins menu. This submenu is usefull to change the plugins option. I make it customizable, so anyone who want to add their own plugin options part can do it very easily.
The plugin will add three option : Gallery Title, Display Format, and Image Type. Display Format is how we put the post_image, post_title, post_author, post_date, and post_comment_count. Image type is how the plugin select the image source to be displayed. Is it using a full image, medium resized image, or its thumbnail. Your WPMU must be installed in the GD available PHP environment to make the medium and thumbnail type works. Otherwise, choose Full image type.
Display Format Example :
{image}{divtitle}{title}{/}{divauthor}{author}, {date}{/}{divcat}{cat}{/}{divcomment}{commentnum}{/}
{image} : display the image (and set the href to its link)
{title} : display the post title (and its link)
{author} : display the post author
{date} : display the post date
{cat} : display categories (and its link)
{commentnum} : display a number of post comment (and its link)
{divtitle} : put the div class=ptbgallery-title tag
{divauthor} : put the div class=ptbgallery-author tag
{divcat} : put the div class=ptbgallery-category tag
{divcomment} : put the div class=ptbgallery-comment tag
{divdate} : put the div class=ptbgallery-date tag
{/} : closing div tag
It also better if you activate my Custom CSS plugin, because the gallery / photo thumbnail in the main page is using some class name: ptbgallery, ptbgallery-title, ptbgallery-author, ptbgallery-category, ptbgallery-date, and ptbgallery-comment. To make the display good looking, the style must be defined for those classes.
The sample CSS definition for all ptbgallery class (combined with Classic Theme) :
.ptbgallery {
margin: 2px;
border: 1px solid #ddd;
text-align: center;
background-color: #f3f3f3;
padding-top: 4px;
padding-bottom: 7px;
width: 190px;
height: 200px;
float: left;
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
.ptbgallery-title { font: 12px Tahoma; padding-top: 3px; }
.ptbgallery-author { font-size: 9px; }
.ptbgallery-category { font-size: 9px; }
.ptbgallery-comment { font-size: 9px; text-align: right; padding: 0px 6px; }
If you don’t have Custom CSS plugin installed, you can also use direct CSS definition in the Display Format (this is the default value used by plugin if you keep Display Format option blank):
{div style="margin: 2px; border: 1px solid #ddd; text-align: center; background-color: #f3f3f3; padding-top: 4px; padding-bottom: 7px; width: 190px; height: 200px; float: left; -moz-border-radius: 3px; border-radius: 3px;"}{image}{div style="font: 12px Tahoma; padding-top: 3px;"}{title}{/}{div style="font-size: 9px;"}{author}, {date}{/}{div style="font-size: 9px"}{cat}{/}{div style="font-size: 9px; text-align: right; padding: 0px 6px;"}{commentnum}{/}{/}
Hope it is usefull,

Sounds like a great plugin. Where can I download it? The link ….download “this file” is not working. Or am I clicking on the wrong link?
Comment by Robert — 25 October 2008 @ 2:50 pm
oh, I got it. Sorry about the false alarm. That’s a strange way to do download.
Anyway thanks for the plugin. I’m going to try it.
Comment by Robert — 25 October 2008 @ 2:55 pm
nice plugin, i’ll try it
Comment by sniperwolf — 4 November 2008 @ 1:01 pm
Sounds like a good idea. But I am not sure where can I place the consolidated images from relevant posts. Do you have a demo site?
Comment by Ngans.com — 12 November 2008 @ 10:47 pm
No, I don’t have a demo site. I use it in our intranet with no problem. You don’t need other place, just like a normal posting. This plugin will take the firsth image from each posting.
Comment by rizapn — 13 November 2008 @ 1:56 pm
thank you, it’s just what i was looking for, i tried it and seems to work fine except it appears this on the head page:
Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/micrscom/public_html/wp-content/plugins/photob_gallery.php on line 82
Warning: array_shift() [function.array-shift]: The argument should be an array in /home/micrscom/public_html/wp-content/plugins/photob_gallery.php on line 82
=== what can it be?
thank you!
Comment by maria — 14 November 2009 @ 10:03 am