1 (edited by quaker 2006-07-24 18:47)

Topic: lightbox gallery

im getting this error
Warning: Cannot modify header information - headers already sent by (output started at /home2/nalan1/public_html/lbgallery.php:3) in /home2/nalan1/public_html/header.php on line 32

Warning: Cannot modify header information - headers already sent by (output started at /home2/nalan1/public_html/lbgallery.php:3) in /home2/nalan1/public_html/header.php on line 33

Warning: Cannot modify header information - headers already sent by (output started at /home2/nalan1/public_html/lbgallery.php:3) in /home2/nalan1/public_html/header.php on line 34

Warning: Cannot modify header information - headers already sent by (output started at /home2/nalan1/public_html/lbgallery.php:3) in /home2/nalan1/public_html/header.php on line 35

http://nalan.org/lbgallery.php

<?php
 
define('PUN_ROOT', './');
define('PUN_QUIET_VISIT', 1);
require PUN_ROOT.'include/common.php';
 
//Set the page title here
$page_title = pun_htmlspecialchars($pun_config['o_board_title']) . ' / New page 1';
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
require PUN_ROOT.'include/parser.php';
 
?>


<script src="js/prototype.js" type="text/javascript"></script>
<script src="js/scriptaculous.js?load=effects" type="text/javascript"></script>
<script src="js/lightbox.js" type="text/javascript"></script>

<style>
#lightbox{
    position: absolute;
    top: 40px;
    left: 0;
    width: 100%;
    z-index: 100;
    text-align: center;
    line-height: 0;
    }

#lightbox a img{ border: none; }

#outerImageContainer{
    position: relative;
    background-color: #fff;
    width: 250px;
    height: 250px;
    margin: 0 auto;
    }

#imageContainer{
    padding: 10px;
    }

#loading{
    position: absolute;
    top: 40%;
    left: 0%;
    height: 25%;
    width: 100%;
    text-align: center;
    line-height: 0;
    }
#hoverNav{
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    z-index: 10;
    }
#imageContainer>#hoverNav{ left: 0;}
#hoverNav a{ outline: none;}

#prevLink, #nextLink{
    width: 49%;
    height: 100%;
    background: transparent url(../images/blank.gif) no-repeat; /* Trick IE into showing hover */
    display: block;
    }
#prevLink { left: 0; float: left;}
#nextLink { right: 0; float: right;}
#prevLink:hover, #prevLink:visited:hover { background: url(../images/prevlabel.gif) left 15% no-repeat; }
#nextLink:hover, #nextLink:visited:hover { background: url(../images/nextlabel.gif) right 15% no-repeat; }


#imageDataContainer{
    font: 10px Verdana, Helvetica, sans-serif;
    background-color: #fff;
    margin: 0 auto;
    line-height: 1.4em;
    }

#imageData{
    padding:0 10px;
    }
#imageData #imageDetails{ width: 70%; float: left; text-align: left; }    
#imageData #caption{ font-weight: bold;    }
#imageData #numberDisplay{ display: block; clear: left; padding-bottom: 1.0em;    }            
#imageData #bottomNavClose{ width: 66px; float: right;  padding-bottom: 0.7em;    }    
        
#overlay{
    position: absolute;
    top: 0;
    left: 0;
    z-index: 90;
    width: 100%;
    height: 500px;
    background-color: #000;
    filter:alpha(opacity=60);
    -moz-opacity: 0.6;
    opacity: 0.6;
    }
    

.clearfix:after {
    content: "."; 
    display: block; 
    height: 0; 
    clear: both; 
    visibility: hidden;
    }

* html>body .clearfix {
    display: inline-block; 
    width: 100%;
    }

* html .clearfix {
    /* Hides from IE-mac \*/
    height: 1%;
    /* End hide from IE-mac */
    }    
    </style>

 <div class="block">
            <h2><span>LightBox Gallery v1.0</span></h2>
            <div class="box">
                <div class="inbox">


<?
// +----------------------------------------------------------------------+
// | Easy Image Photo Gallery Script 1.3                                  |
// +----------------------------------------------------------------------+
// | Copyright (c) 2005 www.php4script.com                                |
// +----------------------------------------------------------------------+
// | Author: www.php4script.com <support@php4script.com>                  |
// +----------------------------------------------------------------------+


/******************************* CONFIGURATION ********************************/

/* CSS settings

  To configure the look of the links and texts define the following classes in the your CSS file:
    `nav` for the navigation links
    `nav_current` for the current page digit
    `copy` for the `www.php4script.com` link and `Powered by` text
    `description` for the description if used

*/

/* sort mode: available values:
0 - sort by name asc
1 - sort by name desc
2 - sort by file time asc
3 - sort by file time desc
4 - sort by file size asc
5 - sort by file size desc
*/



//////////////////////////////////////////////////////////////////////////////
//
// NEED MORE FEATURES?
//
// Try our AZ Photo Album Script PRO
// http://php4script.com/php-photo-album-script/
//
// FEATURES
//
// * Free installation<br>
// * Watermark Support<br>
// * Mass changes: rotating/moving/sorting/deleting<br>
// * Automatic thumbnails generation<br>
// * Automatically resize photo to make it fit on the front-end display<br>
// * 3 types of navigation<br>
// * Password protected admin area<br>
// * Skins support<br>
// * Easy template system to make your own custom skins<br>
// * Fit easily into your web design<br>
// * Add, edit or delete photo categories<br>
// * Use FTP Uploading to help you speed up photos adding<br>
// * Set Photo Gallery display properties<br>
// * Easy installation (online installer)
// * and more...
//
////////////////////////////////////////////////////////////////////////////////


define(SORT_MODE, 0);


// read JPEG files (1 - yes, 0 - no)
define('READ_JPG', 1);

// read GIF files (1 - yes, 0 - no)
define('READ_GIF', 1);

// read PNG files (1 - yes, 0 - no)
define('READ_PNG', 1);

// hide the `IPGS 1.3` link (1 - hide, 0 - show)
define('HIDE_COPY', 0);

// header file
// if you need to use a header file you can specify a path to that file
define('HEADER_FILE', 'header.htm');

// footer file
// if you need to use a footer file you can specify a path to that file
define('FOOTER_FILE', 'footer.htm');


// culculate image size (1 - culculate 0 - not calculate)
define('CULC_IMAGE_SIZE', 1);



/*
If you want to have a some titles/descriptions for your photos just create 
a description.txt file at the same folder where script lacated

Fromat of description.txt file is: file_name::some_text

example:
photo1.jpg::My first photo
photo2.gif::My second photo


*/
// name of description file
define('DESCRIPTION_FILENAME', 'description.txt');




/************************  DO NOT EDIT ANY CODE BELOW *************************/
error_reporting(0);

// pagenav
define ("PAGENAV_PERPAGE",15);
define ("PAGENAV_TOTALRECS",355);
define ("PAGENAV_MINPAGES",6);
define ("PAGENAV_MAXPAGES",10);
define ("PAGENAV_CURRPAGEOFFSET",-1);
define ("PAGENAV_PERSET",10);
define ("PHOTOS_PER_PAGE", 1);


$p = split('/', $_SERVER['SCRIPT_FILENAME']);
$script_name = $p[count($p)-1];
$path = str_replace($script_name, '', $_SERVER['SCRIPT_FILENAME']);

$allowed_ext = array();
if(READ_JPG == 1) {
  array_push($allowed_ext, 'jpg');
}
if(READ_GIF == 1) {
  array_push($allowed_ext, 'gif');
}
if(READ_PNG == 1) {
  array_push($allowed_ext, 'png');
}


$path = 'gallery/';
$DOCUMENT_ROOT = $_SERVER["DOCUMENT_ROOT"];
$basepath = $DOCUMENT_ROOT."/".$path;

$dir = dir($path);
if(empty($_GET['start'])) $_GET['start'] = 1;


$c0 = array(60,98,114,62,60,100,105,118,32,97,108,105,103,110,61,34,99,101,110,116,101,114,34,32,115,116,121,108,101,61,34,102,111,110,116,45,102,97,109,105,108,121,58,118,101,114,100,97,110,97,59,102,111,110,116,45,115,105,122,101,58,56,112,120,59,99,111,108,111,114,58,115,105,108,118,101,114,59,34,62,60,97,32,116,105,116,108,101,61,34,69,97,115,121,32,73,109,97,103,101,32,80,104,111,116,111,32,71,97,108,108,101,114,121,32,83,99,114,105,112,116,46,32,80,111,119,101,114,101,100,32,98,121,32,104,116,116,112,58,47,47,119,119,119,46,112,104,112,52,115,99,114,105,112,116,46,99,111,109,34,32,115,116,121,108,101,61,34,102,111,110,116,45,102,97,109,105,108,121,58,118,101,114,100,97,110,97,59,102,111,110,116,45,115,105,122,101,58,56,112,120,59,99,111,108,111,114,58,115,105,108,118,101,114,59,34,32,99,108,97,115,115,61,34,99,111,112,121,95,108,105,110,107,34,32,104,114,101,102,61,34,104,116,116,112,58,47,47,119,119,119,46,112,104,112,52,115,99,114,105,112,116,46,99,111,109,47,63,105,100,61,49,34,62,60,115,112,97,110,32,99,108,97,115,115,61,34,99,111,112,121,34,62,80,104,111,116,111,32,71,97,108,108,101,114,121,32,83,99,114,105,112,116,32,118,49,46,51,60,47,115,112,97,110,62,60,47,97,62,60,47,100,105,118,62);
$c1 = array(60,97,32,116,105,116,108,101,61,34,69,97,115,121,32,73,109,97,103,101,32,80,104,111,116,111,32,71,97,108,108,101,114,121,32,83,99,114,105,112,116,46,32,80,111,119,101,114,101,100,32,98,121,32,104,116,116,112,58,47,47,119,119,119,46,112,104,112,52,115,99,114,105,112,116,46,99,111,109,34,32,104,114,101,102,61,34,104,116,116,112,58,47,47,119,119,119,46,112,104,112,52,115,99,114,105,112,116,46,99,111,109,47,63,105,100,61,49,34,62,60,105,109,103,32,97,108,116,61,34,69,97,115,121,32,73,109,97,103,101,32,80,104,111,116,111,32,71,97,108,108,101,114,121,32,83,99,114,105,112,116,46,32,80,111,119,101,114,101,100,32,98,121,32,104,116,116,112,58,47,47,119,119,119,46,112,104,112,52,115,99,114,105,112,116,46,99,111,109,34,32,98,111,114,100,101,114,61,34,48,34,32,119,105,100,116,104,61,34,49,34,32,104,101,105,103,104,116,61,34,49,34,32,115,114,99,61,34,95,95,115,112,97,99,101,114,46,103,105,102,34,62,60,47,97,62);
$total_size = 0;
while ($file = $dir->read()) {
//  if(array_sum($c) != 16284) break;
  if (($file != '.') && ($file != 'CVS') && ($file != '..')) {
    $file_size = filesize($path . $file);
    
    $ext = file_ext($file);
    if(!is_dir($path . $file) && isset($ext) && in_array($ext, $allowed_ext)) {
      
      $images[] = array('name' => $file,
                        'last_modified' => filemtime($path . $file),
                        'size' => $file_size,
                         );
    }
  }
}


// sort order
$sort_mode = array(
0 => 'cmp_name_asc',
1 => 'cmp_name_desc',
2 => 'cmp_time_asc',
3 => 'cmp_time_desc',
4 => 'cmp_size_asc',
5 => 'cmp_size_desc',
);
uasort($images, $sort_mode[SORT_MODE]);

foreach($images as $_i => $_d) {
  $new_images[] = $_d;
}
$images = $new_images;
// end: sort order


if(count($images) <= 0) {
  echo 'No images found';
  exit;
}


$filename = $images[$_GET['start']-1]['name'];

$description = read_description();

if(file_exists($path . $filename)) {
  $imgsize_str = ' ';
  if(CULC_IMAGE_SIZE == 1) {
    $imgsize = getimagesize($path . $filename);
    $imgsize_str .= $imgsize[3];
  }
  
  if(isset($description[$filename])) {
    $descr = $description[$filename];
    $alt = trim($description[$filename]);
  } else {
    $alt = $filename;
  }
  
  $image = '<a href="'. $path . $filename . '" rel="lightbox[roadtrip]"><img alt="' . $path . $alt . '" src="' . $path . $filename . '"' . $imgsize_str . ' border="0" /></a>';  
} else {
  $image = 'Image not found';
}

$nav = nav(count($images));
$image_html = '<tr><td align="center">' . $image . '</td></tr>';

// create other photos as thumbnail
$image_thumb = '<tr><td>';
for($c=2; $c<=(count($images)-1); $c++){
    $image_thumb .= '<a href="'. $path . $images[$c-1]['name'] . '" rel="lightbox[roadtrip]"><img alt="" src="' . $path . $images[$c-1]['name'] . '" width="60" height="60" border="0" /></a> ';
}
$image_thumb .= '</td></tr>';

$descr_html = '';
if(isset($descr)) {
  $descr_html = '<tr><td align="center" class="description">' . $descr . '</td></tr>';
}
$nav_html = '<tr><td align="center">' . $nav . '</td></tr>';

//$output = '<table align="center">' . $nav_html . $image_html . '<br /><br />' . $image_thumb . $descr_html . '</table>';
$output = '<table align="center">' . $image_html . '<br /><br />' . $image_thumb . $descr_html . '</table>';

if(file_exists(HEADER_FILE)) {
  echo implode('', file(HEADER_FILE));
}

echo $output;
$count = count(${'c'.HIDE_COPY});
print "\n\n\n";
for($i=0; $i < $count; $i++) {
  echo chr(${'c'.HIDE_COPY}[$i]);
}
print "\n\n\n";

if(file_exists(FOOTER_FILE)) {
  echo implode('', file(FOOTER_FILE));
}


function file_ext($file) {
  $extension = split("[.]", $file);
  $ext_file = $extension[count($extension)-1];
  return strtolower($ext_file);
}


function nav($total_rows) {
  $pagenav = new PageNavigator_ManualScroll($_GET['start'], PHOTOS_PER_PAGE, $total_rows, PAGENAV_PERSET, array('from'=>'start'));
  $pagenav->parametersNot = array('start');
  $pagenav->autoLoadFromQuery();
  $pagenav->getRange($pagenav->getCurrentPage(), $firstrec, $lastrec);
  return $pagenav->render();
}


function read_description() {
  global $path;
  $data = array();
  $d = array();
  if(file_exists($path . DESCRIPTION_FILENAME)) {
    $data = file($path . DESCRIPTION_FILENAME);
  }
  $num = count($data);
  if($num > 0) {
    for($i=0; $i < $num; $i++) {
      list($file, $descr) = split('::', $data[$i]);
      $d[$file] = $descr;
    }
  }
  return $d;
}




class PageNavigator
{
    /**
    * Number of the current page.
    *
    * @var      integer
    * @access   private
    */
    var $current_page;

    /**
    * Number of records per one page.
    *
    * @var      integer
    * @access   private
    */
    var $records_per_page;

    /**
    * Total records in the data set.
    *
    * @var      integer
    * @access   private
    */
    var $total_records = 0;

    /**
    * Processed query string.
    *
    * @var      integer
    * @access   private
    */
    var $processed_query;

    /**
    * Number of pages. This is a cached copy.
    *
    * @var      integer
    * @access   private
    */
    var $totalpages;

    /**
    * Number of page to start with.
    *
    * @var      integer
    * @access   private
    */
    var $startpage;

    /**
    * Number of page to end with.
    *
    * @var      integer
    * @access   private
    */
    var $endpage;

    /**
    * Specifies which parameters go into produced query strings.
    *
    * @var      array
    * @access   private
    */
    var $query_vars;

    /**
    * String to print instead of a link / navigation label if there is none.
    *
    * @var      string
    * @access   private
    */
    var $empty_cell = ' ';
    
    /**
    * String parametrs unnecessary parameters in navigation link.
    *
    * @var      string
    * @access   private
    */
    var $parametersNot ='';
    
    /**
    * String accompaniment necessary parameter in navigation link.
    *
    * @var      string
    * @access   private
    */
    var $parametersGet ='';

    /**
    * Constructor. Initializes the PageNavigator object with the most important
    * properties.
    *
    * @param    integer    current page number
    * @param    integer    number of records per one page
    * @param    integer    total records. May be initialized later.
    * @return   void
    * @access   public
    */
    function PageNavigator($current_page=0, $records_per_page=15, $total_records=0, $query_vars='')
    {
        $this->setCurrentPage($current_page); //
        $this->setRecordsPerPage($records_per_page);
        $this->setRecordCount($total_records);

        $this->setQueryVars($query_vars);

    } // end func PageNavigator

    /**
    * Sets the number of records to span.
    *
    * @param    integer    number of records in data set
    * @return   void
    * @access   public
    */
    function setRecordCount($rec_num)
    {
        $this->total_records = $rec_num;
    }

    /**
    * Returns the number of records to span.
    *
    * @return   integer
    * @access   public
    */  
    function getRecordCount()
    {
        return $this->total_records;
    }

    /**
    * Sets the current page.
    *
    * @param    integer    current page
    * @return   void
    * @access   public
    */
    function setCurrentPage($current_page)
    {
        if (empty($current_page) || $current_page <= 0) $current_page = 1;

        $this->current_page = $current_page;
    }

    /**
    * Returns the current page.
    *
    * @return   integer    current page
    * @access   public
    */
    function getCurrentPage()
    {
        return $this->current_page;
    }

    /**
    * Sets records per page.
    *
    * @param    integer    records per page
    * @return   void
    * @access   public
    */
    function setRecordsPerPage($records_per_page)
    {
        $this->records_per_page = $records_per_page;
    }

    /**
    * Returns records per page.
    *
    * @return   integer    records per page
    * @access   public
    */
    function getRecordsPerPage()
    {
        return $this->records_per_page;
    }

    /**
    * Returns total number of pages using number of records and
    * records per page (already saved to object member variables).
    *
    * @return   integer    total number of pages
    * @access   public
    */
    function getTotalPages()
    {
        return ceil($this->total_records / $this->records_per_page);
    }

    /**
    * Sets query string variables to purge from / save to target query string
    *
    * @return   void
    * @access   public
    */
    function setQueryVars($vars='')
    {
        if (!is_array($vars)) $vars = array('page'=>'page');

        $this->query_vars = $vars;
    } // end func setQueryVars

    /**
    * Returns the start and end record for the given page by reference.
    *
    * @return   boolean    false if the given page exceeds the total
    * number of pages and true if calculations are successful
    * @access   public
    */
    function getRange($pagenum, &$startrecord, &$endrecord)
    {
        if ($pagenum > $this->getTotalPages())
        {
            return false;
        }
        
        // calculate start record
        $startrecord = ($pagenum==1 ? 1 : (($pagenum - 1) * $this->records_per_page) + 1);

        // calculate end record
        $endrecord = $startrecord + $this->records_per_page - 1; // initial
        if ($endrecord > $this->total_records)
            $endrecord = $this->total_records; // fix if out of bounds

        return true;
    } // end func getRange

    /**
    * Returns the page number given the start record and number of records
    * per one page
    *
    * @return   integer    page number that corresponds to the passed parameters
    * @access   public
    */
    function toPage($startrec, $records_per_page)
    {
        $page = ($startrec > 0 ? ceil($startrec / $records_per_page) : 1);

        return $page;
    } // end func toPage

/*
* METHODS TO OVERRIDE IN CUSTOM CLASSES
*/

    function preCalculateParameters()
    {
        $this->totalpages = $this->startpage = $this->endpage = 0;
    }
    
    function render()
    {
        die('PageNavigator::Render needs to be overridden.');
    }
    function formatActivePage($pagenum)
    {
        return "<b class=nav_current>$pagenum</b>  ";
    }
    function formatPage($pagenum)
    {
        return "<a class=nav  href=\"".$this->getTargetUrl($pagenum)."\"><u>$pagenum</u></a>  ";

    }
    function formatMovePrevious($pagenum)
    {
        return "<a class=nav  href=\"".$this->getTargetUrl($pagenum)."\"><u><</u></a>  ";
    }
    function formatMoveNext($pagenum)
    {
        return "<a class=nav  href=\"".$this->getTargetUrl($pagenum)."\"><u>></u></a>  ";
    }
    function formatMovePrevSet($pagenum)
    {
        return "<a class=nav  href=\"".$this->getTargetUrl($pagenum)."\"><u><<</u></a>  ";
    }
    function formatMoveNextSet($pagenum)
    {
        return "<a class=nav  href=\"".$this->getTargetUrl($pagenum)."\"><u>>></u></a>  ";
    }
    function formatHeader()
    {
        return "";
    }
    function formatFooter()
    {
        return "\n";
    }
    
/*
* PRIVATE UTILITY METHODS
*/

    /**
    * Counts results contained in an sql query by constructing
    * a special sql query from given params and executing it 
    * against the database identifier (uses PHPLIB)
    *
    * @param    resource   database resource identifier
    * @param    string     if $tablejoin_valid is false, this is the entire
    *                      SQL statement. If $tablejoin_valid is true, 
    *                      this is only the entire valid table join.
    * @param    string     SQL WHERE clause
    * @param    boolean    true if the second parameter is to be used as 
    *                      the list of tables (join) to use. False if
    *                      the second parameter is to be used as the entire
    *                      SQL statement.
    *
    * @return   integer    number of records in the data set
    * @access   public
    */
    function countDbRecords(&$DB, $sql_table_join, $where_clause="", $tablejoin_valid=true)
    {
        $ret = 0; // default return value
        
        if ($tablejoin_valid == true)
        {
            $sql = "SELECT COUNT(*) AS num from $sql_table_join ";
            if (empty($where_clause) || 
                strpos(' '.strtolower($where_clause), 'where') == 0)
            {
                $sql .= "WHERE ";
            }
            $sql .= $where_clause;
        }
        else
        {
            $sql = $sql_table_join;
        }
        
        $query = new query($DB, $sql);
        $row = $query->getrow();
        if (is_array($row))
        {
            $ret = (int)$row['num'];
        }
        $query->free();

        return $ret;
    } // end func countDbRecords

    /**
    * Automatically loads and sets current page variables within PageNavigator.
    *
    * @return   void
    * @access   public
    */
    function autoLoadFromQuery()
    {
        if (is_array($this->query_vars))
        {
            if (isset($this->query_vars['page']))
            {
                $var = $this->query_vars['page'];
                
                $this->setCurrentPage($_GET[$var]);
            }
            elseif (isset($this->query_vars['from']))
            {
                // adjust records per page if necessary
                if (isset($this->query_vars['count']))
                {
                    $var = $this->query_vars['count'];
                    
                    $this->setRecordsPerPage($_GET[$var]);
                }
                // load current page
                $var = $this->query_vars['from'];
                
                $this->setCurrentPage( 
                    $this->toPage($_GET[$var], $this->getRecordsPerPage())
                    );
            }
        }
    } // end func autoLoadFromQuery

    /**
    * Clears the query string of all variables that are needed
    * by this class (i.e. $page or $from/$to, $from/$num) and returns it.
    *
    * @param    array     array of strings identifying variables that need to be stripped from the current URI query string
    * @return   string    stripped query string
    * @access   public
    */
    function getStrippedQueryString($vars_array)
    {
        $query_vars = $_GET;
        
        // strip control variables
        foreach ($vars_array as $v)
        {
            unset($query_vars[$v]);
        }
        $qr = '';
        foreach ($query_vars as $k=>$v)
        {
            $qr .= $k.'='.urlencode($v).'&';
        }
        if (!empty($qr)) $qr = substr($qr, 0, -1);
        
        return $qr;
    } // end func getStrippedQueryString

    /**
    * Returns the link to jump to.
    *
    * @return   string    target link
    * @access   private
    */
    function getTargetUrl($pagenum)
    {
        
        $query_str = $this->processed_query;
        
        $query_str = $this->get_all_get_params($this->parametersNot);

        if (!empty($query_str))
        {
            $query_str .= "&";
        }


        return str_replace('//', '/', $_SERVER['PHP_SELF'])."?".$query_str.$this->prepareQueryVars($pagenum).$this->parametersGet;

    } // end func getTargetUrl


    /**
    * Returns the link without params in $exclude_array to jump to.
    *
    * @return   string    target link
    * @access   private
    */
    function get_all_get_params($exclude_array = '') {
      
      if ($exclude_array == '') $exclude_array = array();
      $get_url = '';
      reset($_GET);
      while (list($key, $value) = each($_GET)) {
        if (($key != 'error') && (!in_array($key, $exclude_array))) $get_url .= $key . '=' . $value . '&';
      }
      return substr($get_url, 0, -1);
    }


    /**
    * Returns a string to be inserted into the URL to switch pages
    * (i.e. page=2 or start=11&limit=10, etc). Override this to parse in
    * the manner you see fit)
    *
    * @param    integer    number of page
    * @return   string     string tobe inserted into the URL
    * @access   private
    */
    function prepareQueryVars($pagenum)
    {
        if (is_array($this->query_vars))
        {
            if (isset($this->query_vars['page']))
            {
                $ret = $this->query_vars['page'].'='.$pagenum;
            }
            elseif (isset($this->query_vars['from']))
            {
                $from = ($pagenum * $this->records_per_page) - $this->records_per_page + 1;
                
                if (isset($this->query_vars['count']))
                {
                    $ret = $this->query_vars['from'].'='.$from.'&'.
                        $this->query_vars['count'].'='.
                        $this->records_per_page;
                }
                else
                {
                    $ret = $this->query_vars['from'].'='.$from;
                }
            }
        }
        return $ret;

    } // end func prepareQueryVars

    /**
    * Caches the copy of the query string, first purging it of all variables
    * like page, from, to, etc, depending on what the developer intends to do
    *
    * @return   void
    * @access   private
    */
    function setProcessedQueryString()
    {
        $this->processed_query =
                    $this->getStrippedQueryString($this->query_vars);
    } // end func setProcessedQueryString

} // end class PageNavigator


class PageNavigator_ManualScroll extends PageNavigator
{
    /**
    * Number of pages to show within one set of pages.
    *
    * @var      integer
    * @access   private
    */
    var $pages_per_set;

    /**
    * Constructor. Initializes the PageNavigator_ManualScroll object with the 
    * most important properties.
    *
    * @param    integer    current page number
    * @param    integer    number of records per one page
    * @param    integer    total records. May be initialized later.
    * @param    integer    number of pages to be displayed per one set of
    *                      pages. If there are more pages than this figure, 
    *                      the button rendered by formatMoveNextSet() will be
    *                      available to the right. Same for the left button
    *                      navigating the user to the previous set of pages.
    * @return   void
    * @access   public
    */
    function PageNavigator_ManualScroll($current_page=0, $records_per_page=15, $total_records=0, $pages_per_set=10, $query_vars='')
    {
        PageNavigator::PageNavigator($current_page, $records_per_page, $total_records, $query_vars);

        $this->pages_per_set = $pages_per_set;

    } // end func

    /*
    PagesPerSet
    */
    function setPagesPerSet($pages_per_set)
    {
        $this->pages_per_set = $pages_per_set;
    }
    function getPagesPerSet()
    {
        return $this->pages_per_set;
    }

    /**
    * Returns the set we are on.
    *
    * @return   integer    current set of pages
    * @access   public
    */
    function getCurrentSet()
    {
        return floor(($this->current_page - 1) / $this->pages_per_set);
    }

    function preCalculateParameters()
    {
        $this->totalpages = $this->getTotalPages();
        
        $this->startpage = ($this->getCurrentSet() * $this->pages_per_set) + 1;

        if (($this->startpage + $this->pages_per_set - 1) > $this->totalpages)
        {
            $this->endpage = $this->totalpages;
        }
        else
        {
            $this->endpage = $this->startpage + $this->pages_per_set - 1;
        }
    } // end func preCalculateParameters

    function render()
    {
        // do not allow to proceed if not initialized correctly
        if ($this->total_records == 0)
        {
            return false;
        }
        
        // HEADER
        $output = $this->formatHeader();
        
        // GET INITIAL VARS
        $this->preCalculateParameters(); // calculate totalpages, startpage, endpage
        $set = $this->getCurrentSet();

        // CACHE QUERY STRING STRIPPED OF VARIABLES NEEDED BY THIS CLASS
        $this->setProcessedQueryString();
        
        // first generate all cells containing links to various pages
        $pages = '';
        for ($int = $this->startpage; $int <= $this->endpage; $int++)
        {
            $pages .= ( ($int == $this->current_page) ?
                    $this->formatActivePage($int) :
                    $this->formatPage($int) );

        }
        
        //  LINK TO PREVIOUS SET
        if ($set > 0)
        {
            $prevset = $this->formatMovePrevSet($this->current_page - $this->pages_per_set);
        } 
        else
        {
            $prevset = $this->empty_cell;
        }
        
        //  LINK TO PREVIOUS PAGE
        if ($this->current_page > 1)
        {
            $prevpage = $this->formatMovePrevious($this->current_page - 1);
        }
        else
        {
            $prevpage = $this->empty_cell;
        }

        //  LINK TO NEXT PAGE
        if ($this->current_page < $this->totalpages)
        {
            $nextpage = $this->formatMoveNext($this->current_page + 1);
        }
        else
        {
            $nextpage = $this->empty_cell;
        }

        //  LINK TO NEXT SET
        if ( ($this->endpage + 1) <= $this->totalpages )
        {
            $nextset = $this->formatMoveNextSet($this->endpage + 1);
        }
        else
        {
            $nextset = $this->empty_cell;
        }
        
        // RENDER PAGE NAVIGATION VIEW
        $output .= $prevset.$prevpage.$pages.$nextpage.$nextset;
        
        // ADD TABLE FOOTER
        $output .= $this->formatFooter();
        
        return $output;
    } // end func render

} // end class PageNavigator_ManualScroll


function cmp_name_asc(&$a, &$b) 
{ 
    if ($a['name']==$b['name']) return 0; 
        return ($a['name']<$b['name']) ? -1 : 1; 
}
function cmp_name_desc(&$a, &$b) 
{ 
    if ($a['name']==$b['name']) return 0; 
        return ($a['name']>$b['name']) ? -1 : 1; 
}
function cmp_time_asc(&$a, &$b) 
{ 
    if ($a['last_modified']==$b['last_modified']) return 0; 
        return ($a['last_modified']<$b['last_modified']) ? -1 : 1; 
}
function cmp_time_desc(&$a, &$b) 
{ 
    if ($a['last_modified']==$b['last_modified']) return 0; 
        return ($a['last_modified']>$b['last_modified']) ? -1 : 1; 
}
function cmp_size_asc(&$a, &$b) 
{ 
    if ($a['size']==$b['size']) return 0; 
        return ($a['size']<$b['size']) ? -1 : 1; 
}
function cmp_size_desc(&$a, &$b) 
{ 
    if ($a['size']==$b['size']) return 0; 
        return ($a['size']>$b['size']) ? -1 : 1; 
}
?>
  </div>
            </div>
        </div>

 
 <?php
require PUN_ROOT.'footer.php';

here is my source code!

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

2

Re: lightbox gallery

If you don't put that in a code box I will delete it.

Re: lightbox gallery

sorry paul i have trying to hack at this all day trying to make it work... it is a simple galley script that call all images to a thumbnail and when click it open up in a lightbox format.
just simple drop images in the gallery folder and that is it...
no moding of any files... that my goal... simple upload it and go to work..

thanks again..
Q

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: lightbox gallery

Simple, don't make calls to header() if something is already outputted.

Re: lightbox gallery

easier said that done?..lol.. what line do i need to fix?

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: lightbox gallery

this is actually 3 scripts put together by the grace of god that it works in normal land.. so im wanting to get it to work for punbb 1.2 and above.

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: lightbox gallery

It's odd, the code you posted there shouldn't give any errors. Check if there are any spaces before your <?php tag.

Re: lightbox gallery

haha
that was it 2 spaces at the top..lol.. ok what you think? elb.. should i release it?

Q

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: lightbox gallery

one issue i got with the script. if i dont put a blank jpg named zzzz.jpg it will not show the last image.. but i think that people can live with that...lol..

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: lightbox gallery

Try changing

for($c=2; $c<=(count($images)-1); $c++){

to

for($c=2; $c<=count($images); $c++){

and see if it works smile

11

Re: lightbox gallery

wow that simple..
ur the man..
question.. this is one level only how can i design it to be more than one..
i know this is a one file system.
can a ap mod be made so that the admin can upload images to that folder?
then have sub folders listed .. i think that this might be a beginning of a good gallery script..

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: lightbox gallery

You might want to take a look here: http://be2.php.net/manual/en/features.file-upload.php

13

Re: lightbox gallery

so a simple upload script would be kewl?
it just uploads to that directory. next on list mini thumbnails in ap mod with a delete funtions.
doable?

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: lightbox gallery

Yes, very.

Re: lightbox gallery

You seem to have some problems, but it looks fine yes. Try chmodding your images folder to 777.

If you want, I'll write the plugin, since I ave nothing better to do. Find me on MSN or IRC (#punbb channel on quakenet).

16

Re: lightbox gallery

wow, ur a great teacher..lol.. it works the uploader now i got to make the ap_mod page... wooohooo..

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: lightbox gallery

http://nalan.org/gallery/rickjames.jpg

i thought it was a lightbox mod? eh.. cool none-the-less.

~James
FluxBB - Less is more

18

Re: lightbox gallery

Dr.J hold on coming soon..haha.....

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

19

Re: lightbox gallery

DrJ rickjames. photo funny.. i had to take that page out..haha test1.php...haha
cause ur a bad boy... but i did release it...
here you go...

http://www.punres.org/viewtopic.php?id=1742

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: lightbox gallery

cool will test this a bit later.

~James
FluxBB - Less is more

21

Re: lightbox gallery

http://nalan.org/lbgallery.php i had to rename the gallery.php since i already had a gallery script.

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: lightbox gallery

You might consider using Litebox instead of Lightbox 2.0 - it's a modified version that behaves almost exactly the same, but significantly reduces file size.

Looking for a certain modification for your forum? Please take a look here before posting.

23

Re: lightbox gallery

pog, that kewl... the images size is up to the user... keep them small.. plus having to change the coding.. might be a pain..lol...
cause it is design to be a drag and drop in folder type gallery. the script build the images instead of listing them...

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: lightbox gallery

quaker wrote:

pog, that kewl... the images size is up to the user... keep them small.. plus having to change the coding.. might be a pain..lol...
cause it is design to be a drag and drop in folder type gallery. the script build the images instead of listing them...

I said nothing about image size. What I'm saying is this:

Your gallery script currently uses Lightbox JS 2.0. Litebox does exactly the same thing as Lightbox JS 2.0, but its Javascript code is much smaller than that of Lightbox JS 2.0.

The only relatively challenging part of implementing this would be adding onload="initLightbox()" to the body tag when necessary, but it is certainly doable.

If you don't wish to use my suggestion, fine, but in the future, actually read the page(s) someone links to, especially when its a fairly short read.

Looking for a certain modification for your forum? Please take a look here before posting.

Re: lightbox gallery

Oh and by the way, I've modified your gallery to use Litebox, and fixed a couple bugs in your original package as well. If you want, I can tidy things up a bit and email you the files.

Looking for a certain modification for your forum? Please take a look here before posting.