summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpfspot.class.php74
-rw-r--r--phpfspot_cfg.php.dist16
-rw-r--r--themes/default/templates/photo_index.tpl12
3 files changed, 34 insertions, 68 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php
index f686321..cbb6fed 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -112,8 +112,8 @@ class PHPFSPOT {
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()
@@ -906,79 +906,54 @@ class PHPFSPOT {
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']);
@@ -993,20 +968,20 @@ class PHPFSPOT {
}
/* 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 */
@@ -1102,8 +1077,7 @@ class PHPFSPOT {
$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");
diff --git a/phpfspot_cfg.php.dist b/phpfspot_cfg.php.dist
index 7259ac9..b08c123 100644
--- a/phpfspot_cfg.php.dist
+++ b/phpfspot_cfg.php.dist
@@ -62,12 +62,9 @@ class PHPFSPOT_CFG {
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
@@ -134,11 +131,8 @@ class PHPFSPOT_CFG {
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");
diff --git a/themes/default/templates/photo_index.tpl b/themes/default/templates/photo_index.tpl
index 6453725..35a9491 100644
--- a/themes/default/templates/photo_index.tpl
+++ b/themes/default/templates/photo_index.tpl
@@ -42,18 +42,16 @@
</div>
<div id="index">
- {section name="row" loop=$rows step=1}
- {section name="col" loop=$columns step=1}
- {if $images[row][col] }
+ {section name="thumb" loop=$thumbs step=1}
+ {if $images[thumb] }
<div class="thumb" onmouseover="setBackGrdColor(this, 'mouseover');" onmouseout="setBackGrdColor(this, 'mouseout');" style="width: { $thumb_container_width }px; height: { $thumb_container_height }px;">
- <a href="javascript:showImage({$images[row][col]});" id="{$images[row][col]}" name="image{$img_id[row][col]}" class="thumblink" onclick="click(this);" title="{$img_title[row][col]}">
- <img class="thumb" id="{$images[row][col]}" src="phpfspot_img.php?idx={$images[row][col]}&amp;width={$width}" alt="thumb_{$images[row][col]}" width="{$img_width[row][col]}" height="{$img_height[row][col]}" />
+ <a href="javascript:showImage({$images[thumb]});" id="{$images[thumb]}" name="image{$img_id[thumb]}" class="thumblink" onclick="click(this);" title="{$img_title[thumb]}">
+ <img class="thumb" id="{$images[thumb]}" src="phpfspot_img.php?idx={$images[thumb]}&amp;width={$width}" alt="thumb_{$images[thumb]}" width="{$img_width[thumb]}" height="{$img_height[thumb]}" />
<br />
- {$img_name[row][col]}
+ {$img_name[thumb]}
</a>
</div>
{/if}
- {/section}
{/section}
</div>
<br class="clearboth" />