Embed Gallery2 into Magento

ld.jones

Joined: 2008-10-24
Posts: 3
Posted: Fri, 2008-10-24 03:52

Has anyone been successful embedding or integrating Gallery2 into Magento?

I am stuck with this and could use some help.

What I have:
Magento is installed at the root (public_html).
Gallery2 is installed at public_html/gallery2.

I can access my gallery directly at http://www.neighborhoodbeekeeping.com/gallery2/main.php, and all works.

I can access it at http://www.neighborhoodbeekeeping.com/gallery2/gallery2embedded.php, and at least the main page comes up. However, links are broken.

I created a file, g2embed.php in which I have copied the following code from gallery2embedded.php into it:

<?php
$g2_Config['path'] = dirname(__FILE__) . '/';
$g2_Config['g2Uri'] = '/gallery2/';
$g2_Config['loginredirect'] = '../users.php';
$g2_Config['embedUri'] = '/gallery2/gallery2embed.php?';
require_once( $g2_Config['path'] . 'embed.php');
$ret = GalleryEmbed::init(array( 'g2Uri' => $g2_Config['g2Uri'], 'loginRedirect' => $g2_Config['loginredirect'], 'embedUri' => $g2_Config['embedUri'], 'fullInit' =>'false'));
	 if ( $ret )
	{
		echo( '   Here is the error message from G2:' );
		echo( $ret->getAsText() );
		return false;
	 }
GalleryCapabilities::set('login',false);
$g2moddata = GalleryEmbed::handleRequest();

	if (!isset($g2moddata['isDone'])) { 
		echo ('isDone is not defined, something very bad must have happened.'); 
		exit; 
	}
	if ($g2moddata['isDone']) { 
		exit; /* uploads module does this too */ 
	}
	if ($ret) { 
		print $ret->getAsHtml(); 
	} 
GalleryEmbed::done();
?>

If I try to access this via Magento, I get this error:

Warning: include(CoreModule.php) [function.include]: failed to open stream: No such file or directory  in /home1/neighbo8/public_html/app/code/core/Mage/Core/functions.php on line 73
Trace:
#0 /home1/neighbo8/public_html/app/code/core/Mage/Core/functions.php(73): mageCoreErrorHandler(2, 'include(CoreMod...', '/home1/neighbo8...', 73, Array)
#1 /home1/neighbo8/public_html/app/code/core/Mage/Core/functions.php(73): __autoload()
#2 /home1/neighbo8/public_html/gallery2/modules/core/classes/helpers/GalleryPluginHelper_simple.class(62): __autoload('coreModule')
#3 /home1/neighbo8/public_html/gallery2/modules/core/classes/GalleryCoreApi.class(209): GalleryPluginHelper_simple::loadPlugin('coreModule')
#4 /home1/neighbo8/public_html/gallery2/main.php(161): GalleryCoreApi::loadPlugin('module', 'core', true, false)
#5 /home1/neighbo8/public_html/gallery2/main.php(94): _GalleryMain('module', 'core', true)
#6 /home1/neighbo8/public_html/gallery2/modules/core/classes/GalleryEmbed.class(179): GalleryMain()
#7 /home1/neighbo8/public_html/g2embed.php(82): GalleryEmbed->handleRequest(true)
#8 /home1/neighbo8/public_html/app/design/frontend/default/default/template/page/gallery.phtml(25): include('/home1/neighbo8...')
#9 /home1/neighbo8/public_html/app/code/core/Mage/Core/Block/Template.php(144): include('/home1/neighbo8...')

The error comes from GalleryPluginHelper_simple.class, line 62:

if (!class_exists($pluginClass)) {

System info:

Magento version = 1.1.6
Gallery version = 2.2.3 core 1.2.0.5 
PHP version = 5.2.6 cgi-fcgi 
Webserver = Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.8i DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 
Database = mysqlt 5.0.45-community-log, lock.system=flock 
Toolkits = NetPBM, Gd 
Acceleration = full/900, full/900 
Operating system = Linux host254.hostmonster.com 2.6.26-5_2.BHsmp #1 SMP Thu Sep 25 09:22:16 MDT 2008 x86_64 
Default theme = siriux 

Any ideas why this would fail calling from Magento?

Or better yet, has anyone been able to embed Gallery2 into Magento and could share?

Thanks,
Larry

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Fri, 2008-10-24 11:03

I played with it for a few minutes. Magento (very nice app btw) tries to eval everybody else's code.
But try using full system path for $g2_Config['path'] and the full urls for the embedUri and g2Uri.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
ld.jones

Joined: 2008-10-24
Posts: 3
Posted: Fri, 2008-10-24 21:54

I tried using full paths and urls, but I am still getting the same error.
Here's what I used:

$g2_Config[path] = /home1/neighbo8/public_html/gallery2/
g2Uri = http://www.neighborhoodbeekeeping.com/gallery2/
embedUri = http://www.neighborhoodbeekeeping.com/gallery2/g2embed.php

However, thanks for the suggestion...

-Larry

 
ld.jones

Joined: 2008-10-24
Posts: 3
Posted: Fri, 2008-10-24 23:26

OK, for now I am cheating. Every place that I was getting the error for "class_exists(class)" (so far, five files), I passed in "false" as a second parameter.

Also, I have changed the embedUrl to "gallery":

embedUri = 'gallery';

And, I forgot to mention in the original post that the gallery is at http://www.neighborhoodbeekeeping.com/gallery

Even though this is working (at least so far), I would like to know why accessing the gallery through Magento is causing the errors.

If anyone has any ideas, please offer.

-Larry