User:-jansu- - Gallery Codex
Personal tools

User:-jansu-

From Gallery Codex

<?php
/* You'll have to change the /gallery2/ thing in the following 2 lines probably */
require_once(dirname(__FILE__) . '/gallery2/embed.php');
$ret = GalleryEmbed::init(array('fullInit' => true, 'embedUri' => '/', 'g2Uri' => '/gallery2/main.php'));
if ($ret) {
    print 'GalleryEmbed::init failed, here is the error message: ' . $ret->getAsHtml();
    exit;
}
/*
 * See "Site admin" -> "image block" for all available options. the parameters are the same
 * as for the external imageblock
 */
list ($ret, $bodyHtml, $headHtml) = GalleryEmbed::getImageBlock(array('blocks' => 'randomImage',
                                                                'show' => 'title|date'));
if ($ret) {
    print 'GalleryEmbed::getImageBlock failed, here is the error message: ' . $ret->getAsHtml();
    exit;
}
/* $bodyHtml contains the image block. print it somewhere on your website */
print $bodyHtml;
/*
 * $headHtml is not required. if you use imageframes for your imageblocks, you need to print 
 * $headHtml in the <head> section of your web page
 */
?>


list ($ret, $bodyHtml, $headHtml) = GalleryEmbed::getImageBlock(array('blocks' => 'specificItem', 'itemId' => 5
                                                                'show' => 'title|date'));


$retrievedItemID = GalleryCoreApi::fetchItemIdByPath('albumName/imageName.jpg');
list ($ret, $bodyHtml, $headHtml) = GalleryEmbed::getImageBlock(array('blocks' => 'specificItem',
                                                                'itemId' => $retrievedItemID[1],
                                                                'show' => 'title|date'));
advertisements