/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php function lightbox($image,$title='',$ext='jpg',$thumbext='jpg') { $domain = 'http://example.com/'; $alt = ' alt=""'; if( ! $title=='') { $alt=' alt="'.$title.'"'; $title = ' title="'.$title.'"'; } echo '<a'.$title.' rel="lightbox" href="'.$domain.'gallery/'.$image.'.'.$ext.'"><img src="'.$domain.'gallery/'.$image.'_thumb.'.$thumbext.'" /></a>'; } /* ---USING--- put images to gallery folder 1.jpg, 1_thumb.jpg, 2.jpg, 2_thumb.jpg ... then in php u can do this: <ul class="images"> <li><?php lightbox('1'); ?></li> <li><?php lightbox('2'); ?></li> <li><?php lightbox('3'); ?></li> <li><?php lightbox('4'); ?></li> </ul> */