Hi - I am playing around with a php image gallery and Im stuck trying to add lightbox to it. The script automatically builds the gallery, and all anchors to the full size picture are generated. How can I add the rel="lightbox" tag?

echo "<center><a href=\"$PHP_SELF?path=$aPath&page=$aThisPage&img=$aFn&idx=$aIdx\"><img border=\"4\" width=\"$twidth\" height=\"$theight\" src=\"genthumbs.php?image=$fullpath&w=$twidth\"></img></a></center>";

I have tried this to no avail

echo "<center><a href=\"$PHP_SELF?path=$aPath&page=$aThisPage&img=$aFn&idx=$aIdx\"><img rel=\"lightbox\" border=\"4\" width=\"$twidth\" height=\"$theight\" src=\"genthumbs.php?image=$fullpath&w=$twidth\" rel=\"lightbox\"></img></a></center>";

Any Ideas?

Thanks

Recommended Answers

All 2 Replies

echo "<center><a href=\"$PHP_SELF?path=".$aPath."&page=".$aThisPage."&img=".$aFn."&idx=".$aIdx."\"><img rel=\"lightbox\" border=\"4\" width=\"".$twidth."\" height=\"".$theight."\" src=\"genthumbs.php?image=".$fullpath."&w=".$twidth."\" rel=\"lightbox\"></img></a></center>";

I might have missed one or two.. but you need quotes surrounding the variable to drop it out of the echo and surround the variable by periods... or you can use {'s like below. And if the lightbox isn't working, the javascript code is screwed up because that looks fine to me.

Also: Do you realize you have rel=\"lightbox\" in your tag twice?

echo "<center><a href=\"$PHP_SELF?path={$aPath}&page={$aThisPage}&img={$aFn}&idx={$aIdx}\"><img rel=\"lightbox\" border=\"4\" width=\"{$twidth}\" height=\"{$theight}\" src=\"genthumbs.php?image={$fullpath}&w={$twidth}\" rel=\"lightbox\"></img></a></center>";

Thanks for the reply. Its a brand new install of lightbox, and I have tested it by adding a HTML file with an a href to and image with rel="lightbox" and it all works fine. I must just not being seeing the big picture here. Theres two main files to build the gallery, the index, and func which sets it up. I have saved the code as text files so you can look if you would like. Index is here and func is here.
Unfortunately the developer is not interested in his project anymore and shut down his forums, and I am obviosly missing something, so your help is very much appreciated. Greg

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.