Gallery2:Modules:g2drupal - Gallery Codex
Personal tools

Gallery2:Modules:g2drupal

From Gallery Codex

Revision as of 12:42, 26 September 2012 by Dayo (Talk | contribs) (Initial Documentation)

G2Drupal: Drupal Integration Module
Integrates Gallery2 and Drupal CMS
Author: Dayo Akanji
Download the module files here.
Visit the Support Site for enquiries and support requests.

Requirements

  • Gallery 2.3.0+
  • Drupal 7
  • PHP 5.0.4+
  • Both Gallery2 and Drupal must be installed under the same document root.


Description

The G2Drupal Module allows users to organise their photos and other multimedia files in Gallery2 while managing other content using Drupal.

  • The module runs within the Gallery2 Framework resulting in a single set of normal Gallery2 URLs. This removes the usual setup of having a separate gallery address from the embedded address. Users can now maintain search engine rankings and can provide direct links to gallery pages.
  • The module is called just before output is displayed after all the normal Gallery2 process have been run (using a new manually added event) . It then connects to Drupal and retrieves Drupal html output which is then wrapped around the Gallery2 html and this combined output is then displayed.
    A benefit of this is that by using the Gallery2 caching system, previously cached pages can be sent to the user before the module is called resulting in faster speeds and lower resource usage.

Other features are:

  • The Drupal and Gallery2 folders can be located at any offset relative to the other as long as they lie under the same document root.
  • Unified login from Drupal (users logged into Drupal are automatically logged into Gallery2 when user integration is activated).
  • Unified registration via Drupal when user integration is activated
  • Auto points Gallery2 login, logout, account settings and registration links to Drupal when user integration is activated

Package Contents:

The package comes in two folders as follows:

  • Gallery2: Contains the following files to be installed in gallery2
    • g2drupal.zip: This contains the Gallery module files.
    • lib.zip: This contains required additional code.
  • Drupal: Contains the following file to be installed in Drupal
    • g2drupal.tar.gz: This contains the Drupal module files.

Notes

  • Install and post bug notifications to the support site. Subscribe to the announcement forum there to receive notifications. You can also subscribe to the forum post here but this may generate additional emails.
  • Implement the Gallery 2 Performance Tips to improve performance. Similar issues should also be considered on the Drupal side.
  • Make sure you have the Site Administrator registered with the same details on both applications before activating the plugin.
  • The Gallery2 session is subordinate to the Drupal session. If a user is not logged into Drupal, they will be logged out of Gallery2 by the module. Similarly, they will be logged into Gallery2 by the module if logged into Drupal.
  • You can create a full community site by using a similar Fudla Bridge for FUDforum written by the same author.

Installation

Drupal

  • Make sure the Drupal Administrator has the same User Name, Full Name and Email as the Gallery2 Administrator.
  • Install the g2drupal module (g2drupal.tar.gz).

Gallery2

  • Make sure the Gallery2 Administrator has the same User Name, Full Name and Email as the Drupal Administrator.
  • Make sure the elements required to the installed in Drupal have been completed.
  • Make sure both the RefineHTML and JoomG2 modules are not active
  • Unpack lib.zip into the main gallery2 folder so that the contents are in "gallery2/lib/xyz"
  • Around Line 526 of gallery2/main.php is ...

/*
* Session: Find out whether we need to send a cookie & need a new session (only if
* we don't have one yet)
*/
$session =& $gallery->getSession();
$ret = $session->start();
if ($ret) {
return array($ret, null);
}

list ($ret, $shouldCache) = GalleryDataCache::shouldCache('write', 'full');
if ($ret) {
return array($ret, null);
}

if ($embedded) {
$html = $theme->splitHtml($html, $results);
}


Add the following lines above "if ($embedded) {":

/* Added Event: BeforeOutput */
include(dirname(__FILE__) . '/lib/events/Gallery_BeforeOutput.event');


To give:

/*
* Session: Find out whether we need to send a cookie & need a new session (only if
* we don't have one yet)
*/
$session =& $gallery->getSession();
$ret = $session->start();
if ($ret) {
return array($ret, null);
}

list ($ret, $shouldCache) = GalleryDataCache::shouldCache('write', 'full');
if ($ret) {
return array($ret, null);
}

/* Added Event: BeforeOutput */
include(dirname(__FILE__) . '/lib/events/Gallery_BeforeOutput.event');

if ($embedded) {
$html = $theme->splitHtml($html, $results);
}

  • Unpack the module file (g2drupal.zip) to the "gallery2/modules/" folder.
  • Install, configure and activate.


Troubleshooting

advertisements