Gallery2 Plugin Overview
version 1.5
Allows including photos from your gallery2 installation in your posts and syncing of users and session info with gallery2.
Requirements
- b2evolution >= 1.9
- Gallery >= 2.1
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.
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/gallery 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. The
gallery2_plugin will search for your gallery2 installation but it may
likely complain about not being able to find it.
- If the gallery2_plugin found your gallery2 installation you can skip this step.
- Open the settings for the gallery2 plugin.
- Set the directory to your gallery2 installation. This can be a relative
path from b2evolution to your gallery2 installation or an absolute path.
- Set the gallery2 url to be the url to your gallery2 installation. This
can be a relative or absolute url.
- 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.
- Enable the gallery2 plugin.
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.
Gallery Plugin Settings
- Use Single Sign On
Specifies if you would like to use single-sign-on between gallery2 and
b2evolution. Once you select this feature the Gallery2 Plugin will attempt to
sync the existing users between gallery2 and b2evolution. In order for this
feature to work you will need to use the gallery2 embedded page described in the
installation instructions.
- Gallery2 Path
This is the operating system path to your gallery2 installation. It can be an
absolute path on your server or a relative path from your b2evolution
installation directory.This is used to include files from gallery2 necessary
for gallery2 integration.
- Gallery2 Url
This is the url to your gallery2 installation. It can be an absolute url a
relative url from your b2evolution base url. This could be different than the
Gallery2 Path. For example some users have their gallery at
http://gallery.mysite.com/ so they would enter that as an absolute url here.
- Embedded Url
This is the url to your embedded gallery2 page. It can be an absolute url or a
relative url from your b2evolution base url. You will only need to set this if
you use single sign on.
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. 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 re cently 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.
- Thumbnail Size - This settings allows you to set the thumbnail size to display in the widget.
This the value is set to the image height or width, which ever is larger.
Note: This option simply
sets the width and height in html. Specifying this property might cause gallery
to choose a relatively large image and simply have the browser download it to be
resized on the client side. This will increase overall download size of your blog.
- Properties to Show - 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:
$Plugins->call_by_code('evo_gallery2_auth', array("block_start" => '<div class="bSideItem">',
"block_end" => '</div>',
"block_title_start" => "",
"block_title_end" => "",
"title" => "",
"blocks" => "randomImage",
"show_title" => 1,
"show_heading" => 1));
Supported options are:
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)
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.
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 Ian Lewis (IanLewis@member.fsf.org)