Lightbox modal popup displays but image itself does not.

rickers

Joined: 2007-09-12
Posts: 5
Posted: Mon, 2009-08-31 15:21

Any help would be greatly appreciated, I have been struggling getting lightbox to work for several days.

I followed the instructions here: http://gallery.menalto.com/node/55329 which didn't seem to work but after much tweaking and with the help of information here: http://gallery.menalto.com/node/55329 I've come very close. The lightbox dialog pops up but the actual image is not displayed instead a icon suggesting no image is present is displayed:

[img]http://bourgeindesigns.co.uk/lightbox.jpg[/img]

Take a look for yourself here: http://www.bourgeindesigns.co.uk/gallery

Drupal v6.13
Gallery v2.3

Thankyou!
Alan

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Mon, 2009-08-31 16:18

Both the links you posted are for the same thread.

I'm pretty sure the problem is that you're trying the load the resized data at the album level instead of the photo level, which is the default for the Matrix theme. Have you edited theme.inc with any code? Where did you get the "matrixlightbox" theme at?
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
rickers

Joined: 2007-09-12
Posts: 5
Posted: Mon, 2009-08-31 16:42

So they are, apologies poor copy and pasting I suspect. The other link should have been: http://codex.gallery2.org/Gallery2:Lightbox_JS_Tutorial

The theme is simply a copy of the default Matrix theme with the modifications detailed in the lightbox tutorial.

I've added the following to theme.inc:

Quote:
/* Add resizedId to child values, required for Lightbox JS */
if ( $theme['children'] ){
foreach ( $theme['children'] as $key => $value ){
if ( $value['id'] ){
list($ret,$resizedIds) =
GalleryCoreApi::fetchResizesByItemIds(array($value['id']));
if ($ret)
return $ret;
}
$theme['children'][$key]['resizedId'] = $value['id'];
if ( $resizedIds ){
/* Find the best resized option
*
* Use width/height max=800; */
$lboxMaxEdge = 800;
$resizedEdge = NULL;
$resizedId = NULL;
foreach ( $resizedIds[$value['id']] as $resize ){
$width = $resize->getWidth();
$height = $resize->getHeight();
$edge = ( $width > $height )? $width : $height;
if ( $edge <= $lboxMaxEdge ){
if ( !isset($resizedEdge) ){
$resizedId = $resize->getId();
$resizedEdge = $edge;
} else if ( $edge > $resizedEdge ){
$resizedId = $resize->getId();
$resizedEdge = $edge;
}
}
}
$theme['children'][$key]['resizedId'] = $resizedId;
}
}
}
/* end add resizedId to child values, required for Lightbox JS */

Rightly or wrongly I also replaced this in album.tpl

Quote:
{if ($child.canContainChildren || $child.entityType == 'GalleryLinkItem')}
{assign var=frameType value="albumFrame"}
{capture assign=linkUrl}{g->url arg1="view=core.ShowItem"
arg2="itemId=`$child.id`"}{/capture}
{else}
{assign var=frameType value="itemFrame"}
{capture assign=linkUrl}{strip}
{if $theme.params.dynamicLinks == 'jump'}
{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}
{else}
{g->url params=$theme.pageUrl arg1="itemId=`$child.id`"}
{/if}
{/strip}{/capture}
{/if}
<div>
{if isset($theme.params.$frameType) && isset($child.thumbnail)}
{g->container type="imageframe.ImageFrame" frame=$theme.params.$frameType
width=$child.thumbnail.width height=$child.thumbnail.height}
<a href="{$linkUrl}">
{g->image id="%ID%" item=$child image=$child.thumbnail
class="%CLASS% giThumbnail"}
</a>
{/g->container}
{elseif isset($child.thumbnail)}
<a href="{$linkUrl}">
{g->image item=$child image=$child.thumbnail class="giThumbnail"}
</a>
{else}
<a href="{$linkUrl}" class="giMissingThumbnail">
{g->text text="no thumbnail"}
</a>
{/if}
</div>

with

Quote:
{if ($child.canContainChildren || $child.entityType == 'GalleryLinkItem')}
{assign var=frameType value="albumFrame"}
{else}
{assign var=frameType value="itemFrame"}
{/if}
<div>
{strip}
{if isset($theme.params.$frameType) && isset($child.thumbnail)}
{g->container type="imageframe.ImageFrame" frame=$theme.params.$frameType
width=$child.thumbnail.width height=$child.thumbnail.height}
{if ($child.canContainChildren || $child.entityType == 'GalleryLinkItem')}
<a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}" alt="{$title}" title="{$title}">
{else}
{if $theme.params.dynamicLinks == 'jump'}
<a href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$child.resizedId`"}" alt="{$title}" title="{$title}" rel="lightbox[photos]">
{else}
<a href="{g->url params=$theme.pageUrl arg1="itemId=`$child.id`"}" alt="{$title}" title="{$title}" rel="lightbox[photos]">
{/if}
{/if}
{g->image id="%ID%" item=$child image=$child.thumbnail class="%CLASS% giThumbnail"}
</a>
{/g->container}
{elseif isset($child.thumbnail)}
{if ($child.canContainChildren || $child.entityType == 'GalleryLinkItem')}
<a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}" alt="{$title}" title="{$title}">
{else}
{if $theme.params.dynamicLinks == 'jump'}
<a href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$child.resizedId`"}" alt="{$title}" title="{$title}" rel="lightbox[photos]">
{else}
<a href="{g->url params=$theme.pageUrl arg1="itemId=`$child.id`"}" alt="{$title}" title="{$title}" rel="lightbox[photos]">
{/if}
{/if}
{g->image item=$child image=$child.thumbnail class="giThumbnailIce"}
</a>
{else}
<a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}" class="giMissingThumbnail">
{g->text text="no thumbnail"}
</a>
{/if}
{/strip}
</div>

If i left the default code in album.tpl and made the modifications per the lightbox tutorial i.e. updating the links from .ShowItem to .DownloadItem and adding rel="lightbox[photos]" the modal dialog would not pop up at all.