hi there,
some of you might want to implement lightbox into minibb for replacing the standard javascript-popups when displaying [imgs]-images or pictures uploaded through the premium add-on "file attachments and automatic image Galleries"
thanks a lot to paul who helped me optimizing it through adding the values to bb_plugins.php.
here is what i did:
* download lightbox2from
http://www.huddletogether.com/projects/lightbox2/* copy the folders/js/, /images/ and /css/ to your minibb-directory
* edit bb_plugins.phpadd this line somewhere in the code (preferable at the top):
/* lightbox implement */
if($action=='vthread'){
$lightboxjs=<<<out
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
<script src="js/prototype.js" type="text/javascript"></script>
<script src="js/scriptaculous.js?load=effects" type="text/javascript"></script>
<script src="js/lightbox.js" type="text/javascript"></script>
out;
}
/* --lightbox implement */
* edit templates/main_header.htmladd {$lightboxjs} somewhere between <head> and </head>
for use with [imgs]-tags:
* edit bb_codes.phpchange your [imgs]-codes to:
enCodeBB:
/* [IMGS] tag code - with fixed width in lightbox */
$pattern[]="/\[imgs\](http:\/\/([^<> \n\r\[\]&]+?)\.?(gif|jpg|jpeg|png)?)\[\/imgs\]/i";
$replacement[]='<a href="\\1" target="" rel="lightbox"><img src="\\1" alt="" title="" style="width:'.$GLOBALS['imgsWidth'].'px" /></a>';
/* [IMGS] tag code - with fixed width and alt in lightbox */
$pattern[]="/\[imgs=(http:\/\/([^<> \n\r\[\]&]+?)\.?(gif|jpg|jpeg|png)?)\](.*?)\[\/imgs\]/i";
$replacement[]='<a href="\\1" title="\\4" target="" rel="lightbox"><img src="\\1" alt="\\4" title="\\4" style="width:'.$GLOBALS['imgsWidth'].'px" /></a>';
deCodeBB:
/* [IMGs] tag code - with fixed width in lightbox */
$pattern[]="/<a href=\"([^<> \n\r\[\]&]+?)\" target=\"\" rel=\"lightbox\">[ ]<img src=\"([^<> \n\r\[\]]+?)\" alt=\"\" (title=\"\" )?style=\"width:[0-9]+px\" \/><\/a>/i";
$replacement[]="[imgs]\\1[/imgs]";
/* [IMGS] tag code - with fixed width and alt in lightbox */
$pattern[]="/<a href=\"([^<> \n\r\[\]&]+?)\" title=\"(.+?)\" target=\"\"( rel=\"lightbox\")?>[ ]<img src=\"([^<> \n\r\[\]]+?)\" alt=\"(.+?)\" (title=\"(.+?)\" )?style=\"width:[0-9]+px\" \/><\/a>/i";
$replacement[]="[imgs=\\1]\\2[/imgs]";
using lightbox for the image galleries:
* edit bb_plugins.phpchange the line containing $a1 into:
$a1="<a href=\"{$a1_url}\" rel=\"lightbox\" title=\"{$alt}\" onmouseover=\"window.status='{$nameJs}';return true;\" onmouseout=\"window.status='';return true;\">";
that's all
hope it works and you have fun with it
thanks again to paul, hope that it's okay to spread that tiny piece of code of your unbeatable
fileupload-add-on.
to all minibblers out there: if you want to turn your board into some highly configurable imagegallery or file-storage, support the dev-team and buy their truly elegant piece of code which the add-on is. you won't regret it!