Jump to content

andrewweb1

New Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by andrewweb1

  1. Hi guys am having difficulties getting lightbox effect to work in php.The images don't get the lightbox effect 

    here is my code

     

    <!DOCTYPE html>
    <html>
    <head>
    <script type="text/javascript" src="lightbox.js"></script>
    <link rel="stylesheet" href="css/lightbox.css">
    </head>
     
    <body>
     
    <?php
    $page = $_SERVER['PHP_SELF'];
    //settings
    $column =5;
    //dir
    $base ="data";
    $thumbs ="thumbnails";
     
    // get album
    $get_album =$_GET['album'];
     
    if(!$get_album){
    echo "<b>Select an Album:</b><p/>";
    $handle = opendir($base);
    while(($file = readdir($handle)) !==FALSE)
    {
          if(is_dir($base."/".$file) && $file != "." && $file != ".." && $file != $thumbs)
     {
     echo "<a href='$page?album=$file'>$file</a><br>";
    }
    }
    closedir($handle);
    }
    else{
    // check security
    if(!is_dir($base."/". $get_album) || strstr($get_album,".")!=NULL   || strstr($get_album,"/")!=NULL   || strstr($get_album,"\\")!=NULL)
    {
    echo "Album doesn't exist.";
    }
    else{
    $x=0;
    echo "<b>$get_album</b><p/>";
    $handle =opendir($base."/".$get_album);
    while(($file =readdir($handle)) !== FALSE)
    {
    if($file !="." && $file !="..")
    {  
    echo "<table style='display:inline-block;'><tr><td><a href='$base/$get_album/$file' rel='lightbox'><img src='$base/$thumbs/$file'  height='100' width='100'></a></td></tr></table><br/>";
    $x++;
     
    if($x==$column){
    echo "<br/>";
    $x=0;
    }
    }
    }
    closedir($handle);
    }
    echo "<p/><a href='album.php'>Back to albums</a>";
    }
     
    ?>
     
     
    </body>
     
    </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.