public function show()
{
- $this->prepare_single_photo($this->current_photo);
$this->tmpl->assign('tags', $this->tags);
$this->tmpl->show("index.tpl");
} // translate_path
- public function prepare_single_photo($photo)
+ public function showPhoto($photo)
{
+ $all_photos = $this->getAllTagPhotos();
+
+ foreach($all_photos as $all_photo) {
+
+ if($get_next) {
+ $next_img = $all_photo;
+ break;
+ }
+
+ if($all_photo == $photo) {
+ $get_next = 1;
+ }
+ else {
+ $previous_img = $all_photo;
+ }
+ }
+
if(isset($photo)) {
- $this->tmpl->assign('image_url', 'phpfspot_img.php?idx='. $this->avail_photos[$photo] ."&width=". $this->cfg->photo_width);
+ $this->tmpl->assign('image_url', 'phpfspot_img.php?idx='. $photo ."&width=". $this->cfg->photo_width);
}
- if($photo > 0) {
- $this->tmpl->assign('previous_url', "javascript:showImage(". ($photo-1) .");");
+ if($previous_img) {
+ $this->tmpl->assign('previous_url', "javascript:showImage(". $previous_img .");");
}
- if($photo < count($this->avail_photos)) {
- $this->tmpl->assign('next_url', "javascript:showImage(". ($photo+1) .");");
+ if($next_img) {
+ $this->tmpl->assign('next_url', "javascript:showImage(". $next_img .");");
}
- } // prepare_single_photo()
+ $this->tmpl->show("single_photo.tpl");
+
+ } // showPhoto()
public function getAvailableTags()
{
array_push($tagged_photos, $row['photo_id']);
}
-
return $tagged_photos;
} // getAllTagPhotos()
public function showPhotoIndex()
{
- foreach($this->getAllTagPhotos() as $photo)
- {
- $images.= "<img src=\"phpfspot_img.php?idx=". $photo ."&width=". $this->cfg->thumb_width ."\" /><br />\n";
- }
+ $photos = $this->getAllTagPhotos();
+ $count = count($photos);
+
+ $rows = 0;
+ $cols = 0;
+ $images[$rows] = Array();
+
+ for($i = 0; $i < $count; $i++) {
+
+ $images[$rows][$cols] = $photos[$i];
+
+ if($cols == $this->cfg->thumbs_per_row-1) {
+ $cols = 0;
+ $rows++;
+ $images[$rows] = Array();
+ }
+ else {
+ $cols++;
+ }
+ }
+
+ // +1 for for smarty's selection iteration
+ $rows++;
+
+ //$images.= "<img src=\"phpfspot_img.php?idx=". $photo ."&width=". $this->cfg->thumb_width ."\" /><br />\n";
- $this->tmpl->assign('image_matrix', $images);
+ $this->tmpl->assign('count', $count);
+ $this->tmpl->assign('width', $this->cfg->thumb_width);
+ $this->tmpl->assign('images', $images);
+ $this->tmpl->assign('rows', $rows);
+ $this->tmpl->assign('columns', $this->cfg->thumbs_per_row);
$this->tmpl->show("photo_index.tpl");