Adding description to fancybox ?

tiana_arylle

Joined: 2011-02-16
Posts: 3
Posted: Mon, 2011-09-12 00:49

Hi all!

Does anyone know how to add the image description to fancybox, instead of (or in addition to) the title? I'm not that gifted with scripting so this seems a bit out of my league :(

Any help would be greatly appreciated!! Thanks! :)

~ Tia

 
dave8401

Joined: 2009-06-01
Posts: 129
Posted: Tue, 2011-09-13 10:04

How did u configure fancybox, in order to see this "Image 1/xx : Image Title"? I don't see that.

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Tue, 2011-09-13 15:58

this is default behaviour (GD theme) when Gallery mode is used - you need to set "rel" attribute for all thumbs/images in the page

 
dave8401

Joined: 2009-06-01
Posts: 129
Posted: Tue, 2011-09-13 17:21

that's strange; I only have the back-/forward- and the close-button, no matter what I configure.

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Tue, 2011-09-13 18:38

See attached
I did enable FB for my site for today so you can see http://photo.dragonsoft.us/california/bigsur
ColorBox would do the same

And in setting for FB Title Position need to be set to something other than Hide

 
dave8401

Joined: 2009-06-01
Posts: 129
Posted: Thu, 2011-09-15 16:18

Thanks Serge. Now it's working.

@tiana_arylle: A quick solution would be to

change line 531 in libraries/MY_Theme_View.php:
$thumb_content .= '<a title="' . $this->bb2html(html::purify($item->title .": " .$item->description), 2) . '" '. $_shift . ' class="' . $class_name . '" href="' . $direct_link . '">';

and change line 65 in views/photo.html.php:
<a style="<?= ($siblings[$i]->rand_key == $item->rand_key)? "display: static;" : "display: none;"; ?>" title="<?= $theme->bb2html(html::purify($item->title .": " .$item->description), 2) ?>" <?= ($include_single)? "class=\"g-sb-preview\"" : "target=_blank;"; ?> <?= ($include_list)? "rel=\"g-preview\"" : null; ?> href="<?= (access::can("view_full", $item))? $item->file_url() : $item->resize_url(); ?>">

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Thu, 2011-09-15 18:02

Dave, could you add your solution to FB codex page?

 
dave8401

Joined: 2009-06-01
Posts: 129
Posted: Thu, 2011-09-15 19:18

Need to test a little more in the evening (think it won't work across pages). Then I can add it to the codex page.

 
tiana_arylle

Joined: 2011-02-16
Posts: 3
Posted: Fri, 2011-09-16 00:22

Woot Dave, thanks for that code!!!! (And Serge!)

You're right - it doesn't work across pages yet. But considering that I'm a complete n00blet when it comes to php, this was a huge help and a fantastic start. I changed the fancybox overlay setting to overlay so that it stayed tidy and within the image boundaries (the other settings made it spooge). Looks gorgeous!

Sorry I hadn't been talking more earlier (have been bizzy at work).

Thanks SO much!!! Going to be watching this thread closely :)

Thanks Serge too, I know how busy you are with the new greydragon release!

~ Tia