I’ve redone my modification of the ImageBlock!
It will use the standard thumbnailsize if you don’t set $maxSize.
<?php
/**
* ImageBlock
* Gallery2 Image Block for MODx
*
* Shows randomImage, recentImage, viewedImage, randomAlbum, recentAlbum, viewedAlbum, dailyImage, weeklyImage, monthlyImage, dailyAlbum, weeklyAlbum, monthlyAlbum, specificItem.
*
* Depend on the gallery module
* Version: 1.1
*
* You have to call it uncached : [!ImageBlock!]
* or for example , add option [!ImageBlock? &pageid=`5`&blocks=`recentImage`&show=`title|date|views`!]
* default parameter is set to $pageid="-1" , $blocks="randomImage",$show="title|date"
* pageid is default set to "-1". it means link to gallery2 directly.
*
* Parameter (for the getImageBlock line 42):
* 'blocks': List composed with the following items : randomImage, recentImage, viewedImage, randomAlbum, recentAlbum, viewedAlbum, dailyImage, weeklyImage, monthlyImage, dailyAlbum, weeklyAlbum, monthlyAlbum, specificItem ; Separate items with pipes (|) (except specificItem); default value is randomImage
* 'show': List composed with the following items : title, date, views, owner, heading, fullSize ; Separate items with pipes (|) ; the value can be : none (in this case you'll just have the image showing)
* 'itemId': Limit the selection to a specific item ;
* 'maxSize': Max siez of the image (by default it shows thumbnails)
**/
# build mod path
$modpath = $modx->config["base_path"].($mpth ? $mpth:"assets/modules/gallery/");
# include main class
include_once $modpath."g2cms.base.class.inc.php";
$gb = new G2CMS_Base();
require_once($gb->g2Path.'embed.php');
//Parameter
//Gallery2 Embeded page id ( snipet)
$pageid = isset($pageid)? $pageid : '-1'; // if you want to link to gallery2 directly , must be set "-1".
//blocks
$blocks = isset($blocks)? $blocks : 'recentImage';
//show
$show = isset($show)? $show : 'title|date';
//itemId
$itemId = isset($itemId)? $itemId : null;
if ( $pageid == "-1"){
$uri=$gb->g2Uri; // link to gallery2 directly
}
else{
$uri=$modx->makeUrl($pageid); // link to embeded page
}
$ret = GalleryEmbed::init(array(
'embedUri' => $uri,
'g2Uri' => $gb->g2Uri,
'fullInit' => true,
));
if ($ret) {
echo $ret->getAsHtml();
}
if ($blocks == "specificItem" && isset($maxSize)){
list ($ret, $bodyHtml, $headHtml) = GalleryEmbed::getImageBlock(array('blocks' => "$blocks", 'show' => "$show",'itemId' => "$itemId", 'maxSize' => "$maxSize"));
}
elseif ($blocks == "specificItem"){
list ($ret, $bodyHtml, $headHtml) = GalleryEmbed::getImageBlock(array('blocks' => "$blocks", 'show' => "$show",'itemId' => "$itemId"));
}
elseif (isset($maxSize)) {
list ($ret, $bodyHtml, $headHtml) = GalleryEmbed::getImageBlock(array('blocks' => "$blocks", 'show' => "$show", 'maxSize' => "$maxSize"));
}
else {
list ($ret, $bodyHtml, $headHtml) = GalleryEmbed::getImageBlock(array('blocks' => "$blocks", 'show' => "$show"));
}
if ($ret) {
echo $ret->getAsHtml();
}
list($title, $css, $javascript) = GalleryEmbed::parseHead($headHtml);
foreach($css as $c) $modx->regClientCSS($c);
foreach($javascript as $j) $modx->regClientStartupScript($j);
$ret = GalleryEmbed::done();
if ($ret) {
echo $ret->getAsHtml();
}
$bodyHtml=str_replace('<a href',$header.'<a target="_parent" href',$bodyHtml);
/* Shows the image block. */
print $bodyHtml;
?>
Can you replace your code with above when you post a new update of the script?