[siriux] lightbox.js Customization

treqx

Joined: 2006-02-13
Posts: 2
Posted: Mon, 2006-02-13 21:45

Hello all,

Lokesh Dhakar developed a brilliant script that allows displaying an image as an overlay to the existing page, see LightBox JS on his website.

I have attempted to integrate it in the Siriux (1.0.2) theme. Please keep in mind that I am not a PHP developer so this customization will not be up to the standards which Gallery adheres to, for example, you should use the local directory. But, as a proof of concept, it will certainly give you a starting point if you want to do this for your own Gallery.

Here are the steps I took (I will use the patch syntax to illustrate code changes):

1) Download the 5 files from the download section of the page linked above
2) Copy the images (gif and png) into themes/siriux/images
3) Copy lightbox.css and lightbox.js in themes/siriux
4) Modify lightbox.js to indicate the path to the images (I haven't used the overlay picture feature)

38,39c38,39
< var loadingImage = 'loading.gif';		
< var closeButton = 'close.gif';		
---
> var loadingImage = 'http://localhost/gallery2/themes/siriux/images/loading.gif';		
> var closeButton = 'http://localhost/gallery2/themes/siriux/images/close.gif';	
284c284
< 	
---
> 

5) Modify the lightbox.css (#lightboxDetail) to align the caption to the left. This is a minor cosmetic change to make sure that the caption and the View Photo URL are left-aligned on the overlay

9a10
> 	text-align: left;

6) Modify templates/theme.tpl (version 1.5) to include the lightbox stylesheet and script in the HEAD section

12c12
< 
---
>     
19a20
>     <link rel="stylesheet" type="text/css" href="{g->theme url="lightbox.css"}"/>
28a30,32
>     
>     <script type="text/javascript" src="{g->theme url="lightbox.js"}"></script>
> 	

7) Modify theme.inc (version 1.5) to load the resized images IDs in the ShowAlbumPage function so that they are available to album.tpl

103a104,111
> 		
> 		/* Lightbox customization - Fetch resize IDs */
> 	        foreach ($childIds as $childId){ 
> 			list ($ret, $resizeTable) = GalleryCoreApi::fetchResizesByItemIds(array($childId));
> 			if (isset($resizeTable[$childId][0])) {
> 				$theme['resizeId'][$childId] = $resizeTable[$childId][0]->getId();
> 			}
> 		}

8) Modify templates/album.tpl (version 1.5) to change the thumbnail URL to point the resized picture and use Lightbox to overlay it. (Replace the line right underneath <div class="gallery-thumb">) Lightbox will show whatever you pass in title as a caption to the overlay. Mine looks a bit complicated because I wanted to add a link to the normal photo view.

59c59
< 	  <a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}">
---
> 	  <a href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.resizeId[$child.id]`"}" title='{$child.title|markup}<br><a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}">View Photo Page</a>' rel="lightbox">

And that's it! I also use the SquareThumbs module, set the thumbnail size to 100 and set 20 items per page.

I have attached two screenshots (sorry, I do not have a demo site available)

1) Album page before clicking on thumbnail
2) Image shown in overlay on current page

Cheers,
treqx

AttachmentSize
siriux_lb1.jpg63.06 KB
siriux_lb2.jpg68.79 KB
 
iRob
iRob's picture

Joined: 2006-02-12
Posts: 48
Posted: Fri, 2006-03-17 08:38

what is the "patch syntax" for code changes you speak of? I'm having a hard time interpreting your edits. Can you explain?

 
X_Burner

Joined: 2006-03-17
Posts: 1
Posted: Fri, 2006-03-17 19:38

Hi !

Its not working for me...
in the album overview the loading .gif appears but nothing happen...
sure because there gallery should load a page...not a picture !

Could you attach your zipped siriux folder ?

Or post more information...where the excatly youve modified the files ?

THX

X_Burner

 
treqx

Joined: 2006-02-13
Posts: 2
Posted: Mon, 2006-03-20 14:39

Hi,

The patch syntax is based on the UNIX patch command, in hindsight, probably not the best way to post the changes...

Please find attached a zip file containing my Siriux theme directory, backup your existing siriux theme first as this one does use the siriux directory.

Cheers

 
nicokaiser

Joined: 2004-10-04
Posts: 118
Posted: Tue, 2006-03-21 23:49

Is there a way to make this working without JavaScript "transparently"?

* If JavaScript is available => display photo with LightBox
* If JavaScript is *not* available => display photo page like before the patch

 
eduo

Joined: 2003-09-10
Posts: 107
Posted: Thu, 2006-04-20 22:54

Ah, nice. Maybe you'd consider updating it for the newer G2 version (right now it's not compatible) and rename it so it can co-exist with Siriux?

I'd also recommend LightBox 2.0.2, which is the latest and even 2.0.2+ which is modification that can handle more gracefully:

http://www.huddletogether.com/2006/03/29/lightbox-v20/#comment-2424
http://baZzz.com/lightbox/lightbox2.02+.zip

Eduo
---
www.eduo.info
www.eduo.info/gallery/
www.hamsterspit.com

 
Mutiny32

Joined: 2006-05-15
Posts: 4
Posted: Mon, 2006-05-15 04:26

I'm sorry to dig up an old post, but I'd like to implement this on my gallery. The problem is that both lightbox.js and gallery have both changed and I have no clue how to do this. I tried my best to adapt the instructions to the new version of lightbox and theme, but It just doesn't work. It would be greatly appreciated if someone could modify the theme and include the new version of lightbox or at least tell me what I need to do. Thanks.

 
SharpDoggy

Joined: 2006-05-28
Posts: 3
Posted: Sun, 2006-05-28 20:10

i too would love to see how to do this. I'm in love with lightbox ever since i found it a few days ago and would absolutly love to get it

 
steveman2000

Joined: 2006-04-08
Posts: 26
Posted: Tue, 2006-05-30 17:07

hi,

I was just browsing around the site to try to figure out how I would build a theme incorporating the light box script. It looks like u may have beaten me to it though! Although admittedly I haven't looked at ur method in enough detail to figure out if it is exactly what i want though.

My idea is to have a one webpage a bit like a splash screen that when clicked on came up with not a slide show as such but this white box. Basicly it would collaberate all images from say an album.

--
Website: http://me.sllewellyn.com
Gallery: http://www.something-beautiful.org/mygallery

 
Bucky

Joined: 2005-06-01
Posts: 25
Posted: Thu, 2006-06-29 16:34

I'm still trying to intergrate LIghtbox into Siriux 1.1. Has anyon ebeen sucessful doing this? and if so could you play upload your siriux folder or the modified files? I've wrestled for this for about 6 hours, and I still can no tget it to work.

 
iRob
iRob's picture

Joined: 2006-02-12
Posts: 48
Posted: Thu, 2006-06-29 17:37

Bucky, are you using WordPress? The new version of the Lightbox plugin attempts to wrap G2 images but fails. Closer, anyway.

 
Bucky

Joined: 2005-06-01
Posts: 25
Posted: Thu, 2006-06-29 17:42

Its just a stand alone gallery, I really like h0bbel's design he used on his site, http://www.opticalpork.com

I haven't found his theme avaiable, so I read through the thread (http://gallery.menalto.com/node/50101) and tried everythign I could, and still it doesn't work.

The most sucessful thing I did was put on h0bbels theme.tpl and albulm.tpl in my local folder, and when you click the image it acts as if it's going to work, but you just get the continious loading image. My current status is here: http://www.enternetcoders.com/jstafford/main.php

Let me know if you have any ideas, if you'd liek I'm available on aolim as ibuckstah and I also have other messengers too.

Thanks.

 
iRob
iRob's picture

Joined: 2006-02-12
Posts: 48
Posted: Thu, 2006-06-29 17:56

Weird, that's the exact same symptoms on Gallery images I'm seeing with the latest WordPress Lightbox plugin. Hmm, gotta be a solution, but I know way less about Gallery theming and plugins than WordPress. :(

 
Bucky

Joined: 2005-06-01
Posts: 25
Posted: Thu, 2006-06-29 18:01

Thats not what I wanted to here, lol. I wish I could figure it out, it's been bugging me ton's. I'm really trying this out on this gallery, and it's going to be my personal gallery, and if I can get it all working, I have a website that could very much benifit from this also. Man oh man, nothing is ever easy, lol.

 
iRob
iRob's picture

Joined: 2006-02-12
Posts: 48
Posted: Thu, 2006-06-29 18:12

I take it you've contacted h0bbel about his implementation? Any help there?

 
Bucky

Joined: 2005-06-01
Posts: 25
Posted: Thu, 2006-06-29 18:36

I messaged him last night, don't know how often he checks his messages or such though, I might post on his thread, which is what I inteaded to do, but I was in the wrong tab :\.

Thanks.

 
eduo

Joined: 2003-09-10
Posts: 107
Posted: Thu, 2006-06-29 18:40

I guess it all depends on what kind of integration you want:

http://www.eduo.info/2006/04/04/los-15-mejores-paisajes-urbanos/

I decided I didn't want the integration in Gallery itself, although it'd be nice. What I really wanted was integration of lightbox in wordpress for the images I included from G2.

Plugins:
Wordpress:
- WPG2: http://www.blogyourphotos.com/
- Lightbox2: http://www.4mj.it/lightbox

Gallery2:
- DirectImage

So now I include the images from WPG2's interface, change the /v/ with /i/ in the URLs and add the 'rel="lightbox"' bits. I'd want a Lightbox Siriux theme but, to be true, I have no use for anything in any themes until embedded galleries can call their own themes, independently from the theme being used in the album itself.

Eduo
---
www.eduo.info
www.eduo.info/gallery/
www.hamsterspit.com

 
TheGOro

Joined: 2006-07-20
Posts: 2
Posted: Thu, 2006-07-20 13:57

Hi!
Anybody have a working siriux_lightbox theme?
I tried genzil's version with fix (theme.inc 104. line), but i have same problem like ingoman.
I got empty resizedId :(

example: http://goro.obiserver.hu/gallery/

 
scormeny

Joined: 2006-06-27
Posts: 68
Posted: Wed, 2006-10-25 22:46

For others stumbling across this discussion, I recently added a Lightbox JS integration tutorial for Gallery 2.1.2 to this forum. http://gallery.menalto.com/node/55329 . Maybe it will help you!

-Sara

 
Rebecca18

Joined: 2010-02-12
Posts: 1
Posted: Fri, 2010-02-12 23:18

People opine that the college essay writing supposes the really time consuming process. However, people rely on the <a href="http://quality-papers.com">essay writing</a> service assistance every time when that is demanded.