Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
It would be brilliant if Brilliant Gallery enabled the use of captions against the individual images
Comment | File | Size | Author |
---|---|---|---|
#8 | captions-198922.patch | 9.3 KB | mattyoung |
#8 | brilliant_gallary-caption-patched-1.tar_.gz | 22.25 KB | mattyoung |
#11 | ScreenShot_50.jpg | 97.22 KB | gordon.waters |
#9 | functions.inc_.txt | 14.73 KB | juhosbf |
#6 | functions.inc_.patch | 982 bytes | agerson |
Comments
Comment #1
Nitagob CreditAttribution: Nitagob commentedMaybe to explain a bit? How do you see it?
Comment #2
Vacilando CreditAttribution: Vacilando commentedYou may want to use "Display file name as caption" in /admin/settings/brilliant_gallery -- or do you mean something else?
Cheers,
Tomáš
Comment #3
NewZeal CreditAttribution: NewZeal commentedYes, 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.
Comment #4
BradM CreditAttribution: BradM commentedYes, 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.
Comment #5
(not verified) CreditAttribution: commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #6
agerson CreditAttribution: agerson commentedI 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.
Comment #7
rankinstudio CreditAttribution: rankinstudio commentedDo you have the files with these patches already applied?
Thanks
David
Comment #8
mattyoung CreditAttribution: mattyoung commentedMade 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:
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.
Comment #9
juhosbf CreditAttribution: juhosbf commentedBackground:
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.
Comment #10
Vacilando CreditAttribution: Vacilando commentedHi, 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.
Comment #11
gordon.waters CreditAttribution: gordon.waters commentedIt 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.
Comment #12
gordon.waters CreditAttribution: gordon.waters commentedI have recently applied the brilliant_gallary-caption-patched-1.tar_.gz update to my site, and notice that the captions are not being read from the jpg's. I have made the captions via Picasa. I can see that the caption.info file is being created, however it contains the filename and not the caption.
eg.
image767.jpg = "image767.jpg"
I have checked the files in Photoshop and can see the caption created by picasa in the Description field and the ITPC Content-Description field.
Am I missing something.
Thanks
Gordon
Comment #13
gordon.waters CreditAttribution: gordon.waters commentedI notice that when you select Manage Galleries, it overwrites the caption.info replacing whatever is in the file with the default of file names.
Comment #14
mattyoung CreditAttribution: mattyoung commented@gordon.waters: that code has bug. But I don't have time to work on this now...
Reading caption out of jpg file is done with GetID3, it should be very easy to debug reading the right caption field.
So feel free to take the code and debug it and feed it back here.
Comment #15
icymetal CreditAttribution: icymetal commentedThe best way to implement it would be on "Site Configuration |Brilliant gallery | Manage galleries". Here you can add another column, saying caption or text and provide a text field to enter the caption text.
BTW, File name and Thumbnail titles are reversed and the Gallery display (I.e., visible) does not show the current status - it's alway not checked when you come back.
Comment #16
gordon.waters CreditAttribution: gordon.waters commentedI got this working with a external workaround. I created an app that read the captions from my files and then wrote them to the captions.info file that I then uploaded. It works for what I need at the moment.
This can bee seen here http://www.braidwood-web.net.au/majorscreek/yesteryear
Gordon
Comment #17
spyrosn CreditAttribution: spyrosn commentedHey there! Any word about this feature being ported to the Drupal 7 version of the module?
Comment #18
Vacilando CreditAttribution: Vacilando commentedYes, it will be applied within a few days, for both the D6 and D7 version.
Comment #19
STNyborg CreditAttribution: STNyborg commented#Vacilando, I have a request regarding using captions directly from Picasa.
Would it not be possible to use the tags that Google Picasa sends with its RSS feed, seeing that Picasa can actually send these as well? I am currently working on a site that will be using MANY picasa galleries, and it would help our site visitors a lot, if they could read descriptions about the various images - an easy way of managing these captions is to use the tool already in use - the Picasa manager.
I have read through the BG module code and I have found several hints indicating that at some point in time you had considered other caption options. I would be happy to create a patch adding Picasa RSS caption feed to BG, but I have difficulty seeing where in the code BG reads the RSS feed, and how it transforms this to the gallery.
Regards,
ST Nyborg
Comment #20
STNyborg CreditAttribution: STNyborg commentedHi Vacilando. You wrote in September that you were about to release a new update witn Picasa captions enabled? How far is this update?
Regards,
ST Nyborg
Comment #21
apadernoI am closing this issue, which is for a not-supported Drupal version.