Light Box Effect
I have created a page that binds uploaded image thumbnails, ie. thumb1, thumb 2 etc. to a table in a page. I would like to be able to link to the full size image from the thumbnail and show it in a pop up. How do I do this?
I have created a page that binds uploaded image thumbnails, ie. thumb1, thumb 2 etc. to a table in a page. I would like to be able to link to the full size image from the thumbnail and show it in a pop up. How do I do this?
depends on the lightbox you use, with sllimbox:
slimbox
you use a link, with rel attribute:
<a href="images/image-1.jpg" rel="lightbox" title="my caption">image #1</a>
you could create a recordset to return the thumbnail and large image file name, and use those in the link code for example:
<a href="images/<?php echo $row_recordsetName['largeImage']; ?>" rel="lightbox" title="my caption"><img src="thumbs/<?php echo $row_recordsetName['thumbImage']; ?>" /></a>
Thanks for this. It works great.
I am using it to create a dynamic photo gallery so that up to 5 images can be displayed. maybe there's a better way but in my Recordset I have Photo1, Photo2 etc. On the page I bind these to each TD in the table to display them. How would I go about it so that if only 2 images have been uploaded the other 3 are not displayed? At the moment I have each as a placeholder on the page but do not want to show it if empty.
use an if statement:
<?php if($row_recordsetName['Photo1'] != "") { ?>
<td>
Photo1 display.....
</td>
<?php } ?>
<?php if($row_recordsetName['Photo2'] != "") { ?>
<td>
Photo2 display....
</td>
<?php } ?>
etc.....
Using the code:
<tr>
<?php if $row_rsDirectory['Photo1'] != "" { ?>
<td>
<a href="images/uploads/<?php echo $row_rsDirectory['Photo1']; ?>" rel="lightbox" title=""><img src="images/uploads/thumbnails/<?php echo $row_rsDirectory['Photo1']; ?>" /></a></td>
<?php } ?>
<?php if $row_rsDirectory['Photo2'] != "" { ?>
<td><a href="images/uploads/<?php echo $row_rsDirectory['Photo2']; ?>" rel="lightbox" title=""><img src="images/uploads/thumbnails/<?php echo $row_rsDirectory['Photo2']; ?>" /></a></td>
<?php } ?>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
I get an error: Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in C:\xampp\htdocs\affiancedv2\directory\index.php on line 222
sorry, the example code from before was missing () around the if statement conditions, the corrcet sample code shouldbe:
<?php if($row_recordsetName['Photo1'] != "") { ?>
<td>
Photo1 display.....
</td>
<?php } ?>
<?php if($row_recordsetName['Photo2'] != "") { ?>
<td>
Photo2 display....
</td>
<?php } ?>
etc.....
Thanks Jason. You've been a great help.
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.