Hi,
I am interested in using G2 to manage my inventory of merchandise photos, for my website.
I do not desire to use it with user access - and I could login through somewhere else to insert new albums.
I just want to integrate the albums. I was previously on G1 but just completed the upgrade to G2. It's working, and I read the integration document - which didn't make really good sense.
I have tried to access the wrapper code that valiant posted in the other thread, but the file is corrupt.
Any advice on how to achieve this most simple level of integration would be appreciated.
Thanks
Mickey
Posts: 32509
the....file...isn't...corrupt ;) i wrote that in the other topic. i downloaded it myself a few seconds before writing the answer.
what do you mean by "integrate the albums"?
Posts: 6
When I download it I am unable to unzip it - I get unexpected error end of file.
"Integrate just the albums" - I just want to take my webpage, and call the albums from it, meaning just the collections of photos for a specific product.
I don't need the user controls, because I am not letting people log in and post photos anyway. It's just for photos of the guitar amplifiers I build and sell.
You can see the existing site here: http://www.soultoneamps.com
I have a gallery link to the old gallery still, and I have the new one under a new directory - I really just want to integrate the albums in one of my own webpages.
Thanks,
Mickey
Posts: 32509
@file download:
did you try firefox or opera to download the file? did you save it as ... and renamed it to main.zip before opening? i don't think so. it works.
@integration:
something like that? http://www.soultoneamps.com/products.html
why do you need integration for that, just add some <img src=...> tags and let it point to g2.
Posts: 6
The products.html page is a hassle to update and maintain - plus I then need to manage thumbnails, etc, and there is not easy method to embed random photos in any page. Every change I make has to be manual, on my local computer with dreamweaver.
I figured out about the zip being a unix zip last night - that should be posted in that thread (I can do that).
I used your template, removing some superfluous items - and kind of have it working. I'd really like to lose the side menubar from it.
Here's the latest swag at it: http://www.soultoneamps.com/gallery2/TestGallery.php
Posts: 6
Here's my newmain.php from the embedded example above - I am still trying to understand the GalleryCapabilities::set('showSidebar', 'false') , which doesn't seem to to anything.
----- <?php
// File from 'valiant' at gallery.menalto.com forums g2 Integration
// Hacked some stuff out to try to understand it better
// My file I call it from is called "TestGallery.php" it is a regular html file, renamed with
// a .php extension. The only php called in it, is in the big table where I wanted to embed,
// I put
// <?php
// include('newmain.php');
// ? >
// there is no space between the ? and the > in the line directly above...
$data = runGallery();
if (isset($data['bodyHtml'])) {
print <<<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
</head>
<body>
{$data['bodyHtml']}
</body>
</html>
EOF;
}
function runGallery() {
require_once('embed.php');
$data = array();
// if anonymous user, set g2 activeUser to ''
$uid = '';
// when reading the url info keep in mind that the TestGallery.php was put in the G2 root directory, G2
// initiate G2
$ret = GalleryEmbed::init(array('embedUri' => 'TestGallery.php',
'embedPath' => 'gallery2',
'relativeG2Path' => '',
'loginRedirect' => 'index.php',
'activeUserId' => $uid));
if (!$ret->isSuccess()) {
$data['bodyHtml'] = $ret->getAsHtml();
return $data;
}
// user interface: you could disable sidebar in G2 and get it as separate HTML to put it into a block
GalleryCapabilities::set('showSidebar', 'false');
// handle the G2 request - I blocked this too - it was bad, leave it on
$g2moddata = GalleryEmbed::handleRequest();
// show error message if isDone is not defined
if (!isset($g2moddata['isDone'])) {
$data['bodyHtml'] = 'isDone is not defined, something very bad must have happened.';
return $data;
}
// exit if it was an immediate view / request (G2 already outputted some data)
if ($g2moddata['isDone']) {
exit;
}
// put the body html from G2 into the xaraya template
/* I blocked this, and -- everything disappeared -- well, duh, don't block it */
$data['bodyHtml'] = isset($g2moddata['bodyHtml']) ? $g2moddata['bodyHtml'] : '';
// get the page title, javascript and css links from the <head> html from G2
/* I blocked this, to try to lose the superflous stuff, and --
$title = ''; $javascript = array(); $css = array();
*/
/* Yet another block I commented out trying to lose everything but the albums - I could leave it blocked
if (isset($g2moddata['headHtml'])) {
list($data['title'], $css, $javascript) = GalleryEmbed::parseHead($g2moddata['headHtml']);
$data['headHtml'] = $g2moddata['headHtml'];
}
/*
/* Add G2 javascript */
if (!empty($javascript)) {
foreach ($javascript as $script) {
$data['javascript'] .= "\n".$script;
}
}
/* Add G2 css */
if (!empty($css)) {
foreach ($css as $style) {
$data['css'] .= "\n".$style;
}
}
// sidebar block - I commmented this out too.
/*
if (isset($g2moddata['sidebarHtml']) && !empty($g2moddata['sidebarHtml'])) {
$data['sidebarHtml'] = $g2moddata['sidebarHtml'];
}
*/
return $data;
}
---- ?>
Posts: 32509
sorry, the sidebar thing is outdated,
it should be:
GalleryCapabilities::set('showSidebarBlocks', false);
@theme: there are other G2 themes with less clutter / that show less information. you could even create your own g2 theme
if you want to access g2 normally and use embedded g2 albums in your website, you could customize a g2 theme to show a lot of details in standalone, and very clean albums when embedded.
@clean themes:
e.g. wpg2, siriux, ...
http://gallery.menalto.com/gallery/screenshots/screenshotsG2/themes/
http://codex.gallery2.org/index.php/Gallery2:UserContributions#Themes
Posts: 6
Ha! That new function works as intended!
Is there anyway other than themes to keep the ownership and other information from showing?
Posts: 32509
for the matrix theme:
site admin -> themes -> matrix:
untick: "Show album owners"