issue29, when the mouse keeps staying over the link, show also the full photo name
authorAndreas Unterkircher <unki@netshadow.at>
Tue, 10 Jul 2007 19:01:36 +0000 (19:01 +0000)
committerAndreas Unterkircher <unki@netshadow.at>
Tue, 10 Jul 2007 19:01:36 +0000 (19:01 +0000)
git-svn-id: file:///var/lib/svn/phpfspot/trunk@188 fa6a889d-dae6-447d-9e79-4ba9a3039384

phpfspot.class.php
templates/photo_index.tpl

index 47ce21109e2e980f56dd160bc51182f86ebd1b0a..66dc4b5d97d297ebf8acc4d0f5efff6aec9d3ac5 100644 (file)
@@ -119,18 +119,14 @@ class PHPFSPOT {
 
    } // get_photo_details
 
 
    } // get_photo_details
 
-   public function getPhotoName($idx)
+   public function getPhotoName($idx, $limit = 0)
    {
       if($details = $this->get_photo_details($idx)) {
    {
       if($details = $this->get_photo_details($idx)) {
-
          $name = $details['name'];
          $name = $details['name'];
-
-         if(strlen($name) > 15) {
-            $name = substr($name, 0, 10) ."...". substr($name, -10);
+         if($limit != 0 && strlen($name) > $limit) {
+            $name = substr($name, 0, $limit-5) ."...". substr($name, -($limit-5));
          }
          }
-
          return $name;
          return $name;
-   
       }
 
    } // getPhotoName()
       }
 
    } // getPhotoName()
@@ -482,12 +478,14 @@ class PHPFSPOT {
       $img_width[$rows] = Array();
       $img_id[$rows] = Array();
       $img_name[$rows] = Array();
       $img_width[$rows] = Array();
       $img_id[$rows] = Array();
       $img_name[$rows] = Array();
+      $img_title = Array();
 
       for($i = $begin_with; $i < $end_with; $i++) {
 
          $images[$rows][$cols] = $photos[$i];
          $img_id[$rows][$cols] = $i;
 
       for($i = $begin_with; $i < $end_with; $i++) {
 
          $images[$rows][$cols] = $photos[$i];
          $img_id[$rows][$cols] = $i;
-         $img_name[$rows][$cols] = $this->getPhotoName($photos[$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));
 
          $thumb_path = $this->cfg->base_path ."/thumbs/". $this->cfg->thumb_width ."_". $this->getMD5($photos[$i]);
 
 
          $thumb_path = $this->cfg->base_path ."/thumbs/". $this->cfg->thumb_width ."_". $this->getMD5($photos[$i]);
 
@@ -610,6 +608,7 @@ class PHPFSPOT {
       $this->tmpl->assign('img_height', $img_height);
       $this->tmpl->assign('img_id', $img_id);
       $this->tmpl->assign('img_name', $img_name);
       $this->tmpl->assign('img_height', $img_height);
       $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('rows', $rows);
       $this->tmpl->assign('columns', $this->cfg->thumbs_per_row);
 
index 774e142d3ddd13f0297c30566c3f3bdc76cccef2..2aa4fd4c51c81b2d927b7de518716d7962324e98 100644 (file)
@@ -41,7 +41,7 @@
      <td class="thumb">
       {if $images[row][col] }
       <div id="inner" onmouseover="setBackGrdColor(this, 'mouseover');" onmouseout="setBackGrdColor(this, 'mouseout');">
      <td class="thumb">
       {if $images[row][col] }
       <div id="inner" onmouseover="setBackGrdColor(this, 'mouseover');" onmouseout="setBackGrdColor(this, 'mouseout');">
-       <a href="javascript:showImage({$images[row][col]});" id="{$images[row][col]}" name="image{$img_id[row][col]}" class="thumblink" onclick="click(this);">
+       <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]}" />
         <br />
         {$img_name[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]}" />
         <br />
         {$img_name[row][col]}