display additional infos like Exif data, additional tags, ...
authorAndreas Unterkircher <unki@netshadow.at>
Fri, 15 Jun 2007 19:12:01 +0000 (19:12 +0000)
committerAndreas Unterkircher <unki@netshadow.at>
Fri, 15 Jun 2007 19:12:01 +0000 (19:12 +0000)
in the single photo view

git-svn-id: file:///var/lib/svn/phpfspot/trunk@97 fa6a889d-dae6-447d-9e79-4ba9a3039384

phpfspot.class.php
templates/single_photo.tpl

index af51752f8f0b56cabe8b090b7b350de7d789b644..b0440245b4014926d5646a6c7ddc04320b4c6852 100644 (file)
@@ -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 ."&amp;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()
+
 }
 
 ?>
index d2d47c6a342f47ea7591ca83707899eed77c52b7..adeb9f85e3173e410bbc0ae22e7b82e52a46f5a4 100644 (file)
@@ -2,7 +2,8 @@
 <table>
  <tr>
   <td class="index_header" style="text-align: left;">
-   <b>Photo {$image_name}</b>, {$c_date}, {$madewith}<br />
+   <b>Photo {$image_name}</b><br />
+   &nbsp;{$description}<br />
   </td>
   <td class="index_header" style="text-align: right;">
    <a href="{$image_url_full}" target="_blank" onclick="click(this);">
    </table>
    </div>
   </td>
+  <td style="white-space: nowrap;">
+   { if $ExifMadeWith }
+   With: {$ExifMadeWith}<br />
+   { /if }
+   { if $ExifMadeOn }
+   On: {$ExifMadeOn}<br />
+   { /if }
+   { if $ExifOrigResolution }
+   Res: {$ExifOrigResolution}<br />
+   { /if }
+   Size: {$ExifFileSize}kbyte<br />
+   Tagged:<br />
+   { foreach from=$tags key=id item=name }
+   <a href="javascript:Tags('add', '{$id}');" onclick="click(this);">{$name}</a><br />
+   { /foreach }
+  </td>
  </tr>
 </table>
 <!-- /Single photo -->