Search + Lightbox

dranium

Joined: 2008-11-22
Posts: 18
Posted: Sun, 2009-07-05 05:56

I got my search results loading in a lightbox when I click on them. The only problem is that it is loading the full blown image in my lightbox. I need to somehow implement the code below to my SearchShowAll.inc page and my SearchScan.inc page, or maybe there is an easier way for me to retrieve a resized ID?

(This code is from my theme.inc file)

/* 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 */