Hey,
A few months ago I started on a site for a local pub and I started out by using Drupal and ran into trouble with my gallery I wanted to build up. My goal was to have lists of galleries that was generated automatic and used Lightbox for representation.
At first I used Brilliant Gallery, Lightbox V2 and Leightbox ( Non drupal ); I wanted to have links that generated a leightbox popup ( lightbox with text instead of images ) and I finally managed to make it work, it was alot of trouble because leightbox interfered with lightbox.
All that work didn't turn out good because it didn't look nice, the leightbox content was brilliant_gallery and brilliant popped up a lightbox frame and lightbox blinked alot when clicking to the next picture( interfering with leightbox gray frame I guess ).
Q: Someone has any idea of how to do it.. with a good result?
Q: My solution was wierd and time-consuming, is there a easy way to create a lightbox-popup with some text in it? Maybe it already exist, please comment!
Reset.. and a new try..
Instead of using leightbox I turned to popup, and I like the result (the backward-compability is not tested at all though). I changed a content-page and created some text in page.php.
1. Add this to a "gallery page" with input format PHP.
<?php
$dirs = Array();
$names = Array("January","February","Mars","April","May","June","July","August","September","October","November","December");
$gallery_folder = variable_get('brilliant_gallery_folder', '');
$absolpath = realpath(file_directory_path() . '/' . $gallery_folder);
$handle = opendir($absolpath);
drupal_add_js("function pop_w(url){w2=window.open(url,'asdf','fullscreen=0,menubar=0,status=0,toolbar=0,location=0,directories=0,resizable=1,scrollbars=1,height=500,width=800');return false}",'inline');
while ( $dir = readdir($handle) ) {
/* checking and fetching info about the dir, my format is YYYYMMDD_Description */
if (preg_match("/(?<year>\d\d\d\d)(?<month>\d\d)(?<day>\d\d)_(?<text>[\p{L}0-9\s\!]+)/",$dir,$m)) {
if ((int)$m["year"]<=2100&&(int)$m["year"]>=1990&&
(int)$m["month"]<=12&&(int)$m["month"]>0&&
(int)$m["day"]<=cal_days_in_month(CAL_GREGORIAN,
$m["month"],$m["year"])&&
(int)$m["day"]>0) {
/* Creating an array so I can take out what parts I need */
$ar = Array("dir"=>$dir,"year"=>$m["year"],"month"=>$m["month"],"day"=>$m["day"],"text"=>$m["text"]);
array_push($dirs,$ar);
}
}
}
closedir($handle);
arsort($dirs);
$year = $month = NULL;
foreach ($dirs as $key => $v) {
/* Creating 2008 <a href="#" onclick="javascript:pop_w('node/NN/pop/YYYY/MM/DD');"> DD $names[MM] </a>
* The mb_convert_encoding is used for converting strange letters like 'åäö' from windows format to real UTF8 */
if ($year != $v["year"])$myout.="{$v["year"]}<br/>\n";
$myout .= "<a href=\"#\" onclick=\"javascript:pop_w('".url(arg(0).'/'.arg(1).'/pop/'. $v["year"] .'/'.$v["month"].'/'.$v["day"].'/'.$v["text"])."')\">{$v["day"]} {$names[(int)$v["month"]-1]} - ".mb_convert_encoding($v["text"],"UTF-8","Windows-1252")."</a><br />\n";
$year = $v["year"];
}
print($myout);
?>
2. and in page.tpl.php in my theme-catalog I added this after
<?php
$names = Array("January","February","Mars","April","May","June","July","August","September","October","November","December");
$pp = explode('/', drupal_get_path_alias($_GET['q']));
if (arg(0) == 'node' && arg(1) == '1' && arg(2) == 'pop') {
/* my gallery site exist at node/1, this code looks for node/1/pop */
?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?php print $head_title; ?></title>
<?php print $head; ?>
<?php print $styles; ?>
<?php print $scripts; ?>
</head>
<body>
<h1>Pictures from <?php print(arg(3).'-'.arg(4).'-'.arg(5)); ?></h1><br/>
<?php print render_brilliant_gallery(arg(3).arg(4).arg(5).'_'.arg(6)); ?>
</body>
</html>
<?php
} else {
/* ... the original page.tpl.php .. */
}
This will catch my popup and create a very clean list of my gallery. The outcome is a gallery that is easily managable and good-looking, good if a newbie should create his own content. Mind the code..
Q: I tried with creating a page.node.1.pop.php because drupal should catch the adress and use that file, but it didn't use that file. Something I've missed?
Q: I was wondering if something like this exist as a module, and if not I would like some input so that this could be a clean drupal-module, hopefully with a text-based lightbox instead of using a popup ;)
Q: Maybe this idea could be integrated into brilliant gallery?
Regards Josef Johansson
Keywords: albums list gallery directories directory sorted;