list ($ret, $img ) = GalleryEmbed::getImageBlock($blockoptions); print_r ($blockoptions); // print_r($ret); // print_r($img); Array ( [blocks] => |randomImage|dailyImage [show] => |heading [maxSize] => 210 [itemFrame] => notebook [albumFrame] => notebook )
/** * Get HTML for an image block * * @param array ('blocks' => string, 'show' => string, (optional)'heading' => int, * (optional)'itemId' => int, (optional)'maxSize' => int) * 'blocks' is a pipe (|) separated list, of one or more possible blocks which are: * randomImage|recentImage|viewedImage|randomAlbum|recentAlbum|viewedAlbum|specificItem * dailyImage|weeklyImage|monthlyImage|dailyAlbum|weeklyAlbum|monthlyAlbum * 'show' is a pipe (|) separated list of one or more possible choices which are: * title|date|views|owner|heading|fullSize or just 'none' * If you choose 'blocks' => 'specificItem', you must specify 'itemId' too. * example: GalleryEmbed::getImageBlock(array('blocks' => 'randomImage', * 'show' => 'title|date')); * @return array object GalleryStatus * string html content * @static */ function getImageBlock($params) { global $gallery; $moduleId = 'imageblock'; $blockHtml = null; /* Load the module list */ list ($ret, $moduleStatus) = GalleryCoreApi::fetchPluginStatus('module'); if ($ret->isError()) { return array($ret->wrap(__FILE__, __LINE__), null); } if (isset($moduleStatus[$moduleId]) && !empty($moduleStatus[$moduleId]['active']) && $moduleStatus[$moduleId]['active']) { /* Load the G2 templating engine */ GalleryCoreApi::requireOnce(dirname(__FILE__) . '/GalleryTemplate.class'); $template = new GalleryTemplate(dirname(__FILE__) . '/../../..'); $template->setVariable('l10Domain', 'module_' . $moduleId); /* Generate the imageblock */ GalleryCoreApi::requireOnce( dirname(__FILE__) . '/../../imageblock/classes/ImageBlockHelper.class'); list ($ret, $tpl) = ImageBlockHelper::loadImageBlocks($template, $params); if ($ret->isError()) { return array($ret->wrap(__FILE__, __LINE__), null); } if (!empty($tpl)) { /* Render and get the imageblock html */ list ($ret, $blockHtml) = $template->fetch(dirname(__FILE__) . '/../../../' . $tpl); if ($ret->isError()) { return array($ret->wrap(__FILE__, __LINE__), null); } } } else { return array(GalleryStatus::error(ERROR_CONFIGURATION_REQUIRED, __FILE__, __LINE__), null); } return array(GalleryStatus::success(), $blockHtml); }