Using Gallery2's Embed API

Embed sample index ⟐ Embed template ⟐ Simple embed tool
Connect w/ Gallery2
require_once ('/usr/local/www/public_html/gallery2/embed.php'); // Path to Gallery's embed.php
$ret = GalleryEmbed::init(array('g2Uri'=>'', 'embedUri'=>'', 'fullInit'=>'false'));
if ($ret) {
print $ret->getAsHtml();
$gallery->setConfig('showSidebarBlocks', false); // you can hide the sidebarblocks in fact you must to use $g2data['sidebarBlocksHtml']
$gallery->setConfig('login', true); // you can allow for login if you want
$gallery->setConfig('defaultAlbumId', 32); // set the default home album
$ret = GalleryEmbed::setThemeForRequest('matrix');
if ($ret) {
print 'Failed to set theme'.$ret->getAsHtml();
$g2data = GalleryEmbed::handleRequest();
if ($g2data['isDone']) {
<?php echo $g2data['headHtml']; ?>
<link rel="stylesheet" type="text/css" href="/gallery2/main.php?g2_view=imageframe.CSS&g2_frames=shadow"/>

<title>Gallery User Administration</title>
<link rel="stylesheet" type="text/css" href="/gallery2/modules/core/data/gallery.css"/>
<link rel="stylesheet" type="text/css" href="/gallery2/modules/icons/iconpacks/silk/icons.css"/>
<script type="text/javascript" src=""></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="robots" content="noindex"/>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="Mon, 18 Jun 2018 17:33:29 GMT"/>
<link rel="stylesheet" type="text/css" href="/gallery2/themes/matrix/theme.css"/>

Public Media

1. Images 2. Video 3. Audio

Random Image

Rushing Wave

Rushing Wave

Date: 05/15/2008 Views: 104767

Requires $gallery->setConfig('showSidebarBlocks', false); as seen above.

Basically you would only use this if you were planning on placing your sidebar in a specific location in your layout. Otherwise the sidebar is included in bodyHtml.

foreach ($g2data['sidebarBlocksHtml'] as $snippet) {
echo $snippet;
<?php echo $g2data['bodyHtml']; ?>