This is a followup to #992044: Drupal 7 Version?. To summarize the relevant parts from that issue: I created a patch to get Brilliant Gallery working for d7, noticed lots of issues and room for improvement in the course of making that patch, and ended up implementing most of those changes in a complete rewrite (the sandbox is here: http://drupal.org/sandbox/gilgabar/1244482).

I would like to propose using that rewrite as the basis for a 7.x-2.x branch. Failing that, I would like a clear thumbs down from the maintainer so I can rename it and make it into a separate project. And in either case I would love feedback from anyone who cares to use it, so I can make it better.

A summary of some of the changes:
- Half as much code to maintain. Because it...
- Uses core image styles instead of custom code to resize images.
- Adds hook_brilliant_gallery_lightbox_info() to allow easy lightbox plugin support (Colorbox, Lightbox2, and Shadowbox are currently included).
- Adopts an OO style to improve organization, improve code reuse, and take advantage of autoloading.
- Allows deletion of galleries and images from the admin interface.
- Uses render arrays. Includes caching of the rendered galleries.
- Adds a gallery field (currently functional, but not well tested).
- Drops custom Views code. Using fields gives us Views support for free.
- Drops Picasa support. The way this was implemented it downloaded Picasa albums to the galleries directory based on the bg filter tag and then treated the photos the same as any other manually uploaded images. So anyone able to use the bg filter is able to put files on your server. This should be in its own module instead with its own permissions and only accessible via an admin interface.
- Compatible with the same bg tags used in 6.x.
- Also supports named tags (e.g. [bg|location=gallery] instead of [bg|gallery]). But...
- Drops support for unnecessary tags: columns, width, and color. Columns and width were only needed when tables were used for layout. This uses floated unordered lists which will automatically flow to fill a given space. If you wish it to fill less space then CSS is the appropriate way to handle that. Color similarly is better handled via CSS.
- Allows recursive galleries, so it will optionally display images within nested directories.
- Allows random galleries.
- A flexible API: calling brilliant_gallery_render($parameters) where $parameters is either a string (a bg tag) or an associative array keyed by tag name will generate a gallery anywhere you call it. You may also create a gallery object directly for more control.

I'm sure it's not perfect, but I believe it is enough of an improvement over the existing 7.x branch to be of interest to other people. I have been running it in production on one client's site for several months now without issue.

CommentFileSizeAuthor
#6 brilliant_gallery.zip16.26 KBgilgabar
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drpchris’s picture

Awesome work.
Tomas has developed a great module but doesn't seem to have enough time to maintain it. Would be great to see a cleaned up version I can re-apply my hacks to.

gilgabar’s picture

@druchris1 what are some examples of the hacks you would want to apply? Ideally I would want to make this something that can be cleanly extended without requiring folks to hack things. Either that or just include those features if they are generally useful.

drpchris’s picture

Nothing too major - I have a simple one that sets the slideshows to play automatically with lightbox2 by using rel=lightshow; one that I got from this forum that does a random picture in a block; some small formatting things that are probably best done other ways.

gilgabar’s picture

I will look into adding slideshow support. I think that should be pretty straightforward.

You can make a block with a random image a few different ways without any hacks. The easiest is probably to add a block via admin/structure/block/add, set the body to a text format that handles brilliant gallery tags, and add this to the body: [bg|location=?|limit=1|sort=false]. That would add a random image from all the galleries available on your site. If you wanted to show a random image from a single gallery it would be [bg|location=my_gallery|limit=1|sort=false].

You could also add a custom block in a module via hook_block_info()/hook_block_view() and use brilliant_gallery_render($parameters) as the content of your block where parameters is an array that looks like:

$parameters = array(
  'location' => '?',
  'limit' => 1,
  'sort' => false,
);

And another alternative is to use Views and a brilliant gallery field to create a block. But as mentioned earlier, the field implementation isn't well tested yet.

vacox’s picture

Final Update: I put this at the top because what's below is a mess. I am completely confused about the behavior of this module. Can you please let me know how to get your build (I don't know how to get the files from git) so I can give it a try? And, is it sufficient to just disable the module, replace the files, and re-enable the module, or does an "uninstall" have to be done? Sorry I'm so clueless. Any help is sincerely appreciated.


Hi, I would like to try using your rewrite. I am a new user of Drupal and would love to use Brilliant Gallery, if it worked! Here is what I've done so far (I'm using latest Drupal core, running on one of Dreamhost's Linux servers, if you need to know that):

Used the current release build: got undefined variable "timenow" and "no displayable images" in my logs #1442028: error: Undefined variable: timenow in load_dir_to_array. Plus a host of other warnings (notices?) that went away and never returned for me to write down. I know this is vague, sorry... (oh, see update, below).

Switched to current dev build, in which reference to "timenow" is removed from functions.inc and the "no displayable images" messages were gone from my log, BUT I just don't see anything on my page. No complaints about bg, don't see the tag, just empty.

I've double checked that the files are viewable by Drupal, I've set up the brilliant gallery tag and used it for the node. I've tried using various types of bg tags, my directory for brilliant gallery images is under the files directory, everything I can find has been checked twice. Currently I'm just trying [bg|foo] where foo is a directory containing images that I am able to load into Drupal in other ways, and foo is under sites/default/files/gallery_images and gallery_images is what I've defined to BG as my image location.

When I updated to the developer build, I did not do the "uninstall" from Drupal, I just replaced the files and re-enabled the module. Would that screw things up (yes, I am totally new to this)?

Do you think your build would help me? I would just go ahead and try it but I don't know how to get the files from git.

Update: here's a warning I still see:
Notice: Undefined index: type in drupal_write_record() (line 6894 of .../common.inc)

I see the images when I look at /brilliant_gallery but I also see tons of these notices. But on the page where I'm using the tag, nothing shows--no warnings, no pictures. I have Brilliant Gallery set as the first filter.

gilgabar’s picture

FileSize
16.26 KB

Yes, if you are unfamiliar with git it can be difficult to try out sandbox modules. To make it easier for you or anyone else to try out the rewrite I have attached a zip file with the current code to this post. You should be able to follow the directions in the included README. I would recommend both disabling and uninstalling any previous version of brilliant gallery to avoid potential conflicts. If you have any problems or questions feel free to follow up either here or in the sandbox issue queue.

vacox’s picture

Thank you so much. I will try it out later today! Thanks again,

Vanessa

vacox’s picture

Great, pictures are now showing up. Thanks! BTW, I did have to change the php version I'm using; default on my hosting service is 5.2.something. Needed 5.3. Not that that's your problem. :-) Thanks again.

Vanessa