Gallery2 Plugin
The Gallery2 plugin allows including photos from your Gallery2 installation in your posts using the Gallery2 Image Chooser and syncing of users and session info with Gallery2.
Author | |
---|---|
Last tested in version |
Gallery2 is a photo display, management and organization tool. From the Gallery2 homepage:
Gallery gives you an intuitive way to blend photo management seamlessly into your own website whether you're running a small personal site or a large community site".
Note: Gallery2 is a separate installation from b2evolution and from the Gallery2 plugin. The Gallery2 plugin does not include Gallery2. Gallery2 is aimed at users who would like to use Gallery2 as a photo management software and integrate it with b2evolution.
Requirements
- b2evolution >= 1.9
- Gallery >= 2.1
Note: You will need to have a version of Gallery2 greater than 2.1 already installed on your site for the Gallery2 plugin to work. Gallery2 is not included in the Gallery2 plugin. See the Gallery2 homepage.
Download
Version 1.5.1: http://downloads.sourceforge.net/evocms-plugins/gallery2_plugin-1.5.1.zip gallery2_plugin-1.5.1.zip Release Notes/Changelog
Help/Support
If you need help or support installing or using the Gallery2 plugin please post your problem to this forum topic in the b2evolution forums. Posting to this topic notifies the developers and ensures the fastest response.
Participation
In general anyone can participate in making Gallery2 Plugin better. You can participate in a number of ways.
- Bugs should be submitted to the sourceforge tracker
- Feature requests should be submitted to the sourceforge tracker
- Patches should be submitted to the sourceforge tracker
You may also view the current SVN repository
Documentation
Gallery2 Plugin Installation
Installation of the Gallery2 Plugin can be complicated based on how you have your b2evolution setup. However, If you have a fairly standard setup you should be able to install this plugin without modifying any source code files.
Note: Gallery2 is a separate program and will need to be installed separately from the Gallery2 Plugin. Please see the Gallery2 website for more information about how to install Gallery2.
Installation
The installation of the gallery2 plugin requires a little more than simply copying the plugin directory to the plugins folder. Based on how you plan to use the gallery2 plugin you may be able to skip some steps.
- Unzip the zip file and copy the gallery2_plugin folder to your blogs/plugins folder.
- If you don't want to use single sign on with gallery2 you can skip this step.
- Copy the gallery2_plugin/gallery2 folder to where you would like gallery to be located on your webserver. The gallery folder must be under your b2evolution blogs directory. ''Note: Users will access this location from now on to get single sign on.''
- Edit the gallery/main.php file so that the first include statement points to the b2evolution blogs/conf/_config.php
- Install the gallery2 plugin in the b2evolution admin interface. It may complain about not being able to find your gallery installation if it could not find it.
- Open the settings for the gallery2 plugin.
- Set the Gallery2 directory to be the relative path from b2evolution to your Gallery2 installation. Note: The Gallery2 directory is the path to where you installed Gallery2. Gallery2 is not included with the Gallery2 plugin. It is a separate installation. Please see the requirements section.
- If you are using single sign on, check the single sign on check box and set the embedded path to the relative path from your b2evolution blogs directory to the gallery folder you uploaded in step 2.
- Save the settings
- If the gallery2_plugin could not find your gallery2 installation in step 2 you will need to enable it now. Note: If you use single sign on, when you enable the plugin your b2evolution users and gallery2 users will be synced. The first admin user in gallery2 will be synced with the first admin in b2evolution
- If you use single sign on, edit your gallery2 config.php and set mode.embed.only to true. Note: This will disable your previous gallery2 urls. Access your gallery via the gallery folder uploaded in step 2.
Single-Sign-On Notes and Gotchas
- If you use the gallery2 url rewrite plugin, consult this document to configure it for embedded mode.
- Follow these steps if you have an existing gallery that was under your blogs directory and you would like to preserve your previous urls.
- Rename your existing gallery2 installation directory to something else (e.g. gallery2 => oldgallery2)
- Rename the gallery2_plugin/gallery folder to match your previous gallery2 installation (e.g. gallery => gallery2)
- Access the gallery2 plugin options in b2evolution admin and set the Gallery2 path and embed path according to the previous steps.
- Install and configure the url rewrite plugin for gallery2. See this document.
- In the Site Admin => URL rewrite => Rules page, enable the "Show Item" and "Download Item" rules.
- You should not use the gallery2 Site Admin => Users interface from this point forward. Make all changes to users through the b2evolution interface. While users will be synced with gallery automatically, site admins will need to maintain the groups and permissions in b2evolution and gallery separately. This is partly because b2evolution lacks any callbacks for creating/editing/deleting groups in it's plugin interface.
Inserting Gallery2 photos into posts
You can insert Gallery2 photos into posts using the "G2Image" button at the bottom of the compose window when writing a new post in the admin interface. Pressing the G2Image button will bring up a popup window with which you can select photos from your gallery. Simply select the photos you wish to insert by checking the check box in the upper-left corner of each photo and click the "Insert" button.
There are several methods with which you can insert photos. Under the "Insertion Options" you can select from the "How to Insert Image" drop down box one of the following options. Most are self explanatory. The default values for this and all of the options that appear in the G2Image window can be set in the Gallery2 Plugin Settings.
- Thumbnail with link to image
- Thumbnail with link to parent album This will insert a thumbnail image to your post that links to the album the image is in.
- Thumbnail with LightBox link to Fullsized/Resized Image This will insert a thumbnail image to your post that has a Lightbox link to the fullsized or first resized version of the image. You will need the Lightbox plugin installed for this to work. Inserting a Lightbox group will allow you to group photos together using Lightbox2. If you use Lightbox1 this should be set to be blank.
- Thumbnail with link to custom URL This will insert a thumbnail image to your post with a link to a URL that you specify.
- Thumbnail only - no link
- Fullsized image with link to Gallery page for image'
- Fullsized image only - no link
- Text link to image
- Text link to parent album
Using the Gallery2 image block widgets.
The Gallery2 Plugin provides the ability to add image block widgets in conjunction with the Image Block Plugin for Gallery2. You must have the Gallery2 Image Block plugin installed and activated in order to use these the Gallery2 Plugin widgets. These widgets can display random images, recent images, viewed images etc. from your Gallery2 gallery in your b2evolution blog's side bar or page top areas of your blog. It can be added any number of times with any number of combinations of options.
Widget Options
The Gallery2 Plugin widget allows you to select a number of options.
- Custom Heading
- Image type. The widget allows you to select from a number of image block types.
- Random image - A random image from your gallery
- Recent image - The most recently added image from your gallery
- Viewed image - A recently viewed image from your gallery
- Random album - A random album from your gallery
- Recent album - A recently added album from your gallery
- Viewed album - A recently viewed album from your gallery
- Daily image - An image randomly selected and shown for the entire day
- Weekly image - An image randomly selected and shown for the entire week
- Monthly image - An image randomly selected and shown for the entire month
- Daily album - An album randomly selected and shown for the entire day
- Weekly album - An album randomly selected and shown for the entire week
- Monthly album - An album randomly selected and shown for the entire month
- Link URL - A url to be linked to from the image. A blank value defaults to the image or album location.
- Link Target - Allows you to have the link open in a new browser window or the existing browser window.
- Properties to Show<br/>Several properties of the selected image or album can be shown.
- Heading - A heading based on the image type
- Title - The image or album title
- Date - The image or album date
- View count - The image or album view count
- Owner - The image or album owner
Using the widgets in b2evolution 1.9 - 1.10
The Gallery2 image block widgets are supported in versions of b2evolution older than 2.0. Widgets are supported by adding some code to your blog skin. It will be a call to the SkinTag() function in the Gallery2 Plugin which is called via the b2evolution plugins interface. It will look something like the following:
<!-- codeblock lang=php line=1 --><pre class="codeblock"><code>
$Plugins->call_by_code('evo_gallery2_auth', array("block_start" => '<div class="bSideItem">',
"block_end" => '',
"block_title_start" => "",
"block_title_end" => "",
"title" => "",
"blocks" => "randomImage",
"show_title" => 1,
"show_heading" => 1));
</code></pre><!-- /codeblock -->
Supported options are:
<!-- codeblock lang= line=1 --><pre class="codeblock"><code>
blocks - An array containing blocks to show or a string containing a single
block name
valid values: randomImage, recentImage, viewedImage, randomAlbum,
recentAlbum, viewedAlbum, dailyImage, weeklyImage,
monthlyImage, dailyAlbum, weeklyAlbum, monthlyAlbum,
specificItem
show_title - Show the item title.
show_heading - Show the item heading.
show_date - Show the item date.
show_viewcount - show the item view count.
show_owner - show the item owner
itemid - Limit the item selection to the subtree of the gallery under the
album with the given id; or the id of the item to display when
used with specificItem block type
maxSize - Scale images to this maximum size. If used alone Gallery will
locate the most-closely-sized image to the specified value -
larger images will be scaled down as necessary in your browser.
If specified along with show=fullSize the full size image will
always be used and scaled down as necessary.
exactSize - Just like g2_maxSize except that it will not substitute an
image smaller than the size you request, so you'll get the
closest match in size possible. Note that this may use a lot
more bandwidth if a much larger image has to be scaled down in
your browser.
link - Href for link on image; value of none for no link; default is link
to item in the Gallery.
linkTarget - Add a link target
(for example, to open links in a new browser window)
</code></pre><!-- /codeblock -->
Widget customization
In order to get the widget to display properly in the areas of your blog skin other than the sidebar you may need to customize the css stylesheet for your skin.
You can do this by creating a css class called "widget_plugin_evo_gallery2_auth" and/or the css class called "one-image" modifying it's properties. You can also make any customizations you may need or wish to the display of the widget this way. See this page for some examples on how to customize the css of the image block.
Using the Gallery2 Plugin with the TinyMCE Plugin
The Gallery2 plugin can be used with the TinyMCE Plugin but it requires some extra work. Thankfully though, Gallery2 Image Chooser is itself a TinyMCE plugin so integrating it with TinyMCE is somewhat simple.
- On your local harddrive, open the g2image directory in the gallery2_plugin directory. Copy the entire g2image directory to the plugins/tinymce_plugin/tiny_mce/plugins directory. From there open the config.php and edit the first line of code to have five '..'s. <code class="codespan">require_once dirname(FILE).'/../../../../../conf/_config.php';</code>
- Upload the entire g2image directory to the plugins/tinymce_plugin/tiny_mce/plugins directory.
- Open the admin interface and edit the settings for the tinymce plugin. In the 'Plugins' field, add 'g2image' to the end of the list. In the 'Custom TinyMCE init' add the following line: <code class="codespan">theme_advanced_buttons3_add : "iespell,advhr,separator,print,separator,g2image"</code>
And there you have it, you should now be able to see a new button on the right side of the toolbar for inserting gallery2 images. This will popup a window for inserting gallery2 images into your posts that uses the gallery2 plugin settings.
Future Direction
- Syncing of users in Gallery2 multi-site installs to multiple b2evolution blogs.
- Better support for the TinyMCE Plugin.
- Add javascript to automatically add the g2image button to tinymce. See code for the Wordpress Gallery2 plugin.
- Better support for the FCKEditor Plugin.
- b2evolution 2.x support.
- Add support for a b2evolution page that will display your gallery like the Wordpress plugin.
- Use of b2evolution 2.x User Permissions 2.0
- Add widgets that can be viewed in a side panel on your blog.
- Album list
- Add support for user locking in Gallery >= 2.2 (This may not be included in GalleryEmbed yet)
- Create themes that can be used with Gallery and b2evolution to give a unified feel. Perhaps start by making b2evolution versions of gallery themes and vice versa?
- Add support for GalleryEmbed::getImageBlock() or GalleryEmbed::getBlock(), depending on the gallery2 version, so that displaying image blocks doesn't require the readfile() function.
License
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Warranty
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Copyright (C) 2007-2008 Ian Lewis (IanLewis@member.fsf.org)
Hey guys, thansk a lot for the plugin. very usefull. Peter