if(!isset($_SESSION['searchfor']))
$_SESSION['searchfor'] = '';
- // if begin_with is still set but rows_per_page is now 0, unset it
- if(isset($_SESSION['begin_with']) && $this->cfg->rows_per_page == 0)
+ // if begin_with is still set but thumbs_per_page is now 0, unset it
+ if(isset($_SESSION['begin_with']) && $this->cfg->thumbs_per_page == 0)
unset($_SESSION['begin_with']);
} // __construct()
if(isset($_SESSION['begin_with']) && $_SESSION['begin_with'] != "")
$anchor = $_SESSION['begin_with'];
- if(!isset($this->cfg->rows_per_page) || $this->cfg->rows_per_page == 0) {
+ if(!isset($this->cfg->thumbs_per_page) || $this->cfg->thumbs_per_page == 0) {
$begin_with = 0;
$end_with = $count;
}
- elseif($this->cfg->rows_per_page > 0) {
+ elseif($this->cfg->thumbs_per_page > 0) {
if(!isset($_SESSION['begin_with']) || $_SESSION['begin_with'] == 0) {
$begin_with = 0;
}
else {
-
$begin_with = $_SESSION['begin_with'];
-
- // verify $begin_with - perhaps the thumbs-per-rows or
- // rows-per-page variables have changed or the jump back
- // from a photo wasn't exact - so calculate the real new
- // starting point
- $multiplicator = $this->cfg->rows_per_page * $this->cfg->thumbs_per_row;
- for($i = 0; $i <= $count; $i+=$multiplicator) {
- if($begin_with >= $i && $begin_with < $i+$multiplicator) {
- $begin_with = $i;
- break;
- }
- }
}
- $end_with = $begin_with + ($this->cfg->rows_per_page * $this->cfg->thumbs_per_row);
+ $end_with = $begin_with + $this->cfg->thumbs_per_page;
}
-
- $rows = 0;
- $cols = 0;
- $images[$rows] = Array();
- $img_height[$rows] = Array();
- $img_width[$rows] = Array();
- $img_id[$rows] = Array();
- $img_name[$rows] = Array();
+ $thumbs = 0;
+ $images[$thumbs] = Array();
+ $img_height[$thumbs] = Array();
+ $img_width[$thumbs] = Array();
+ $img_id[$thumbs] = Array();
+ $img_name[$thumbs] = Array();
$img_title = Array();
for($i = $begin_with; $i < $end_with; $i++) {
if(isset($photos[$i])) {
- $images[$rows][$cols] = $photos[$i];
- $img_id[$rows][$cols] = $i;
- $img_name[$rows][$cols] = htmlspecialchars($this->getPhotoName($photos[$i], 15));
- $img_title[$rows][$cols] = "Click to view photo ". htmlspecialchars($this->getPhotoName($photos[$i], 0));
+ $images[$thumbs] = $photos[$i];
+ $img_id[$thumbs] = $i;
+ $img_name[$thumbs] = htmlspecialchars($this->getPhotoName($photos[$i], 15));
+ $img_title[$thumbs] = "Click to view photo ". htmlspecialchars($this->getPhotoName($photos[$i], 0));
$thumb_path = $this->get_thumb_path($this->cfg->thumb_width, $photos[$i]);
if(file_exists($thumb_path)) {
$info = getimagesize($thumb_path);
- $img_width[$rows][$cols] = $info[0];
- $img_height[$rows][$cols] = $info[1];
- }
-
- if($cols == $this->cfg->thumbs_per_row-1) {
- $cols = 0;
- $rows++;
- $images[$rows] = Array();
- $img_width[$rows] = Array();
- $img_height[$rows] = Array();
- }
- else {
- $cols++;
+ $img_width[$thumbs] = $info[0];
+ $img_height[$thumbs] = $info[1];
}
+ $thumbs++;
}
}
// +1 for for smarty's selection iteration
- $rows++;
+ $thumbs++;
if(isset($_SESSION['searchfor']) && $_SESSION['searchfor'] != '')
$this->tmpl->assign('searchfor', $_SESSION['searchfor']);
}
/* do we have to display the page selector ? */
- if($this->cfg->rows_per_page != 0) {
+ if($this->cfg->thumbs_per_page != 0) {
$page_select = "";
/* calculate the page switchers */
- $previous_start = $begin_with - ($this->cfg->rows_per_page * $this->cfg->thumbs_per_row);
- $next_start = $begin_with + ($this->cfg->rows_per_page * $this->cfg->thumbs_per_row);
+ $previous_start = $begin_with - $this->cfg->thumbs_per_page;
+ $next_start = $begin_with + $this->cfg->thumbs_per_page;
if($begin_with != 0)
$this->tmpl->assign("previous_url", "javascript:showPhotoIndex(". $previous_start .");");
if($end_with < $count)
$this->tmpl->assign("next_url", "javascript:showPhotoIndex(". $next_start .");");
- $photo_per_page = $this->cfg->rows_per_page * $this->cfg->thumbs_per_row;
+ $photo_per_page = $this->cfg->thumbs_per_page;
$last_page = ceil($count / $photo_per_page);
/* get the current selected page */
$this->tmpl->assign('img_id', $img_id);
$this->tmpl->assign('img_name', $img_name);
$this->tmpl->assign('img_title', $img_title);
- $this->tmpl->assign('rows', $rows);
- $this->tmpl->assign('columns', $this->cfg->thumbs_per_row);
+ $this->tmpl->assign('thumbs', $thumbs);
$this->tmpl->show("photo_index.tpl");
var $photo_width = "640";
var $mini_width = "100";
- /* how many columns in the photo index view */
- var $thumbs_per_row = 4;
-
- /* how many rows should be displayed on the photo index view */
- /* use 0 to display all matching photos on one page */
- var $rows_per_page = 4;
+ /* how many thumbnails should be displayed on the photo index view */
+ /* use 0 to display all matching photos on one page */
+ var $thumbs_per_page = 50;
/* Usually the photo directory differs between your local F-Spot installation
and your webserver. With this you can advice phpfspot to replace all paths
if(!isset($this->mini_width) || $this->mini_width == "")
$this->showError("Please set \$mini_width in phpfspot_cfg");
- if(!isset($this->thumbs_per_row) || $this->thumbs_per_row == "")
- $this->showError("Please set \$thumbs_per_row in phpfspot_cfg");
-
- if(!isset($this->rows_per_page) || $this->rows_per_page == "")
- $this->showError("Please set \$rows_per_page in phpfspot_cfg");
+ if(!isset($this->thumbs_per_page))
+ $this->showError("Please set \$thumbs_per_page in phpfspot_cfg");
if(!isset($this->path_replace_from) || $this->path_replace_from == "")
$this->showError("Please set \$path_replace_from in phpfspot_cfg");