From: Andreas Unterkircher Date: Fri, 15 Jun 2007 19:12:01 +0000 (+0000) Subject: display additional infos like Exif data, additional tags, ... X-Git-Tag: phpfspot-1.2~238 X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=commitdiff_plain;h=64aff8eab7dca9b848149d9061a33af0d44f24b9 display additional infos like Exif data, additional tags, ... in the single photo view git-svn-id: file:///var/lib/svn/phpfspot/trunk@97 fa6a889d-dae6-447d-9e79-4ba9a3039384 --- diff --git a/phpfspot.class.php b/phpfspot.class.php index af51752..b044024 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -121,15 +121,22 @@ class PHPFSPOT { $details = $this->get_photo_details($photo); $meta = $this->get_meta_informations($this->translate_path($details['directory_path']) ."/". $details['name']); $info = getimagesize($this->translate_path($details['directory_path']) ."/thumbs/". $this->cfg->photo_width ."_". $details['name']); - + + $this->tmpl->assign('description', $details['description']); + $this->tmpl->assign('image_name', $details['name']); + $this->tmpl->assign('width', $info[0]); $this->tmpl->assign('height', $info[1]); - $this->tmpl->assign('c_date', $meta['DateTime']); - $this->tmpl->assign('madewith', $meta['Make'] ." ". $meta['Model']); - $this->tmpl->assign('image_name', $details['name']); + $this->tmpl->assign('ExifMadeOn', strftime("%a %x %X", $meta['FileDateTime'])); + $this->tmpl->assign('ExifMadeWith', $meta['Make'] ." ". $meta['Model']); + $this->tmpl->assign('ExifOrigResolution', $meta['ExifImageWidth'] ."x". $meta['ExifImageLength']); + $this->tmpl->assign('ExifFileSize', round($meta['FileSize']/1024, 1)); + $this->tmpl->assign('image_url', 'phpfspot_img.php?idx='. $photo ."&width=". $this->cfg->photo_width); $this->tmpl->assign('image_url_full', 'phpfspot_img.php?idx='. $photo); + $this->tmpl->assign('tags', $this->get_photo_tags($photo)); + if($previous_img) { $this->tmpl->assign('previous_url', "javascript:showImage(". $previous_img .");"); } @@ -213,7 +220,8 @@ class PHPFSPOT { if(!isset($_SESSION['selected_tags'])) $_SESSION['selected_tags'] = Array(); - array_push($_SESSION['selected_tags'], $tag); + if(!in_array($tag, $_SESSION['selected_tags'])) + array_push($_SESSION['selected_tags'], $tag); } // addTag() @@ -680,6 +688,25 @@ class PHPFSPOT { } // rotateImage() + private function get_photo_tags($idx) + { + $result = $this->db->db_query(" + SELECT t.id, t.name + FROM tags t + INNER JOIN photo_tags pt + ON t.id=pt.tag_id + WHERE pt.photo_id='". $idx ."' + "); + + $tags = Array(); + + while($row = $this->db->db_fetch_object($result)) + $tags[$row['id']] = $row['name']; + + return $tags; + + } // get_photo_tags() + } ?> diff --git a/templates/single_photo.tpl b/templates/single_photo.tpl index d2d47c6..adeb9f8 100644 --- a/templates/single_photo.tpl +++ b/templates/single_photo.tpl @@ -2,7 +2,8 @@
- Photo {$image_name}, {$c_date}, {$madewith}
+ Photo {$image_name}
+  {$description}
@@ -54,6 +55,22 @@
+ + { if $ExifMadeWith } + With: {$ExifMadeWith}
+ { /if } + { if $ExifMadeOn } + On: {$ExifMadeOn}
+ { /if } + { if $ExifOrigResolution } + Res: {$ExifOrigResolution}
+ { /if } + Size: {$ExifFileSize}kbyte
+ Tagged:
+ { foreach from=$tags key=id item=name } + {$name}
+ { /foreach } +