Captions

New Zeal - December 7, 2007 - 22:31
Project:Brilliant Gallery
Version:6.x-3.6
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:patch (to be ported)
Issue tags:fix, patch
Description

Hi,

It would be brilliant if Brilliant Gallery enabled the use of captions against the individual images

#1

Nitagob - December 8, 2007 - 17:44

Maybe to explain a bit? How do you see it?

#2

vacilando - December 9, 2007 - 16:35
Status:active» fixed

You may want to use "Display file name as caption" in /admin/settings/brilliant_gallery -- or do you mean something else?

Cheers,

Tomáš

#3

New Zeal - December 10, 2007 - 20:20

Yes, I know about displaying the file name as a caption, which is great. What I mean is having a textfield into which you can enter a caption describing the picture for the viewer which is then displayed either within a frame including the picture or beside the picture.

Since making this comment I have installed the Acidfree module and lo and behold it picks up the lightbox effect, so that now I have a gallery with captions that also uses lightbox. For a demo visit www.passingphase.co.nz/alart/Taradale and click on gallery->events in the main menu. Here you will see an Acidfree gallery, click on a picture and you get a lightbox. At gallery->trips is an example of brilliant gallery. Brilliant gallery has advantages over other galleries in that you can insert one anywhere. Between the two types of galleries I have greater flexibility, however I still think that not having a caption function (even if optional) is a weakness for brilliant gallery.

#4

BradM - December 19, 2007 - 07:18

Yes, I agree the display filename works great. But an additional text file (image1.txt to go with image1.jpg) that, say, contains copyright info to display below the image, would be helpful. But I think this is more of a lightbox module feature request.

#5

Anonymous - January 2, 2008 - 07:22
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

#6

agerson - May 2, 2009 - 21:59
Version:5.x-2.14» 6.x-3.0
Status:closed» patch (to be ported)

I have created two patches that enable custom, per image captions. These patches assume the following:

1. You have "Display file name as caption" turned on.
2. You have a text file in your sub gallery folder named "captions.txt"
3. This file has strings of text, one per line. Each line will display a caption for an image in the same order the files are displayed.
4. This will not work with "random" images.

This would be a great feature to more formally role onto Brilliant Gallery.

AttachmentSize
functions.inc_.patch 982 bytes
brilliant_gallery.module.patch 1 KB

#7

rankinstudio - August 23, 2009 - 05:56

Do you have the files with these patches already applied?

Thanks

David

#8

mattyoung - December 3, 2009 - 05:51

Made a patch to do caption in a more flexible way:

1. I have disable the "Display file name as caption" settings, now always display some caption regardless of what this setting is and default to file name
2. Automatically scan gallery directory, create a 'caption.info' file and automatically get caption right out of jpg and png file. For jpg, get the caption from IPTC/Caption-Abstract field or EXIF:ImageDescription, with Adobe Lightroom, this can be set with the Metadata tab Caption field. For png, use the comments/title field.
3. The caption.info file is in the format:

filename1.jpg = "Caption text"
filename2.png = "Caption text"
filename3.png = "filename3.png"

you can edit this text file to change the caption text, use '<none>' to display no caption. Order is *not* important, you can re-arrange it.

4. When you add new files to the gallery, visit admin/settings/brilliant_gallery/manage
click the gallery folder, to update the caption.info file with new images. You don't click 'Save' on that page, simply visit that page does this.

Possible extensions:

Use the caption.info file to controll the order the image display
Change the gallery manager to allow edit of caption text and drag-and-drop re-arrange image order

unfortunately that page does not use drupal theme method so it's a bigger job to make this change than I have time for.

BTW, this patch includes the showdowbox patch I made #588934: Patch for shadowbox

!!!This is dependent on the getid3 module, you must install the module first.

AttachmentSize
captions-198922.patch 9.3 KB
brilliant_gallary-caption-patched-1.tar_.gz 22.25 KB

#9

juhosbf - October 26, 2009 - 00:29

Background:

We should display captions for images with special accented characters (Finnish, Hungarian).
Displaying filename did not work, as all special characters were replaced by rectangles.
#6 offered a promising solution to display captions from file, so we tried it.

In our windows test site the patch worked fine, but on linux staging the captions fetched from the captions.txt file were mixed up systematically and completely.
After looking in the functions.inc, found the reason: the lines of the ordered captions.txt are assigned to the unordered list of filenames. When the filenames are sorted, the captions become in wrong order. So after debug we got:

Array (
[0] => Array ( [file] => pic018.jpg [caption] => pic042 ... )
[1] => Array ( [file] => pic042.jpg [caption] => pic116 ... )
[2] => Array ( [file] => pic086.jpg [caption] => pic304 ... )
[3] => Array ( [file] => pic116.jpg [caption] => pic119 ... )
...
)

We recommend the following correction to functions.inc (after applying the patch on brilliant_gallery.module):

1) Same as in the patch, but add a test if captions.txt exist:

function load_dir_to_array($absolpath, $imagewidth, $fullresolutionmaxwidth, $brilliant_gallery_sort) {
++ # Load captions.txt into array
+ if (file_exists($absolpath."/captions.txt")) {
+ $file_handle = fopen($absolpath."/captions.txt", "r");
+ while (!feof($file_handle) ) {
+ $line_of_text = fgets($file_handle);
+ $parts[] = $line_of_text;
+ }
+ fclose($file_handle);
++ }
+
# Load Directory Into Array

2) do NOT add the following lines from the patch here, as it is too early here, and it will wrongly match the filenames and the lines in captions txt

+ #Add caption into array
+ $retval_dimensions[$poct]['caption'] = $parts[$poct];

3) Instead, place these 2 lines after closing the dir. Sort the array, then add the lines from caption.txt, and if needed, shuffle the array. Should work also with random order galleries, as filenames and captions will match in the array.

@closedir($handle);
- if ($brilliant_gallery_sort == '1') {
- @sort($retval_dimensions);
- }
- else {
+
+ #Add caption into array
+ #This will work also with rand
+ @sort($retval_dimensions);
+ $retval_size = count($retval_dimensions);
+ for ($i = 0; $i < $retval_size; $i++) {
+ $retval_dimensions[$i]['caption'] = $parts[$i];
+ }
+ if ($brilliant_gallery_sort != '1') {
shuffle($retval_dimensions);
}

Back to the special characters:

After saving the captions.txt with utf8 encoding, the special characters display correctly.

AttachmentSize
functions.inc_.txt 14.73 KB

#10

vacilando - October 26, 2009 - 09:34

Hi, thanks for the custom captions code. For BG 6.x-4.x - just recently born and still defunct (don't install as yet) there will be a solution for multiple captions, but it would be impractical for a large number of images.

I could use some of the code provided for cases where one needs to provide captions for many images. However, it would be good to avoid having to create captions.txt files on the server. Instead, could you figure out a way how to specify captions in textareas on the management screen. Note - the management screen needs to be able to accommodate also Picasa galleries.

If you provide patches, do them against 6.3 dev version for the time being, please.

#11

gordon.waters - November 16, 2009 - 11:21
Version:6.x-3.0» 6.x-3.6

It would be good if BG could read the caption that picasa can set in the picasa desktop application - See screen-shot - and display it in the same place as the file name - if you have selected display file name as caption.

AttachmentSize
ScreenShot_50.jpg 97.22 KB
 
 

Drupal is a registered trademark of Dries Buytaert.