How Can I Remove The File Name in The Alt Tag Hover Info For Full Size Images? How Can I Remove The File Name in The Alt Tag Hover Info For Full Size Images?
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

How Can I Remove The File Name in The Alt Tag Hover Info For Full Size Images?

Started by gldickens3, August 10, 2007, 12:23:13 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gldickens3

Hello,

I have modified my installation so that the alt tag hover info does not display the file name on thumbnails as prescribed here:

http://forum.coppermine-gallery.net/index.php?topic=10521.msg47674#msg47674

However, when the user click's on an intermediate image which produces a full size pop up, then the following balloon text is displayed when the user hovers over the full sized image:

"IMAGE_NAME.jpg Click image to close this window"

As an example: "DSCN1001.jpg  Click to close this window"

So, my question is, how do I get rid of the file name info?  I would like to keep the phrase: "Click image to close this window" but I would prefer not to display the file name.

Thanks in advance!

Gordon





Joachim Müller

Edit themes/yourtheme/theme.php, findfunction theme_display_fullsize_pic()and edit as suggested below. If you don't have that function in your custom theme, copy// Display the full size image
function theme_display_fullsize_pic()
{
    global $CONFIG, $THEME_DIR, $ALBUM_SET;
    global $lang_errors, $lang_fullsize_popup, $lang_charset;

    if (isset($_GET['picfile']))
    {
        if (!GALLERY_ADMIN_MODE) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);

    $picfile = $_GET['picfile'];
    $picname = $CONFIG['fullpath'] . $picfile;
    $imagesize = @getimagesize($picname);
    $imagedata = array('name' => $picfile, 'path' => path2url($picname), 'geometry' => $imagesize[3]);
    }
    elseif (isset($_GET['pid']))
    {
    $pid = (int)$_GET['pid'];
    $sql = "SELECT * " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='$pid' $ALBUM_SET";
    $result = cpg_db_query($sql);

    if (!mysql_num_rows($result)) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);

    $row = mysql_fetch_array($result);
    $pic_url = get_pic_url($row, 'fullsize');
    $geom = 'width="' . $row['pwidth'] . '" height="' . $row['pheight'] . '"';
    $imagedata = array('name' => $row['filename'], 'path' => $pic_url, 'geometry' => $geom);
    }

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=<?php echo $CONFIG['charset'] == 'language file' $lang_charset $CONFIG['charset'?>" />
  <title><?php echo $CONFIG['gallery_name'?>: <?php echo $lang_fullsize_popup['click_to_close'];
      
?>
</title>
  <script type="text/javascript" src="scripts.js"></script>
  <style type="text/css">
  body { margin: 0; padding: 0; background-color: gray; }
  img { margin:0; padding:0; border:0; }
  #content { margin:0 auto; padding:0; border:0; }
  table { border:0; height:100%; width:100%; border-collapse:collapse}
  td {         vertical-align: middle; text-align:center; }
  </style>
  </head>
  <body>
    <script language="JavaScript" type="text/JavaScript">
      adjust_popup();
    </script>
    <table>
      <tr>
            <td>
          <div id="content">
              <?php     echo  '<a href="javascript: window.close()"><img src="'
                
htmlspecialchars($imagedata['path']) . '" '
                
$imagedata['geometry']
                . 
'alt="'
                
htmlspecialchars($imagedata['name'])
                . 
'" title="'
                
htmlspecialchars($imagedata['name'])
                . 
"\n" $lang_fullsize_popup['click_to_close']
                . 
'" /></a><br />' ."\n";
               
?>

          </div>
        </td>
      </tr>
    </table>
  </body>
</html>
<?php
}
from themes/sample/theme.php into a new line before?>of the file themes/yourtheme/theme.php

Then find in above mentioned code              <?php     echo  '<a href="javascript: window.close()"><img src="'
                
htmlspecialchars($imagedata['path']) . '" '
                
$imagedata['geometry']
                . 
'alt="'
                
htmlspecialchars($imagedata['name'])
                . 
'" title="'
                
htmlspecialchars($imagedata['name'])
                . 
"\n" $lang_fullsize_popup['click_to_close']
                . 
'" /></a><br />' ."\n";
               
?>
and replace with              <?php     echo  '<a href="javascript: window.close()"><img src="'
                
htmlspecialchars($imagedata['path']) . '" '
                
' title="'
                
$lang_fullsize_popup['click_to_close']
                . 
'" /></a><br />' ."\n";
               
?>

gldickens3

Hi GauGau,

Thanks!  You da man!  Your suggested modification works great.

However, as an FYI for future reference, I had to slightly change your mod syntaticly to get it to work properly.  Instead of:

. ' title="'

I substituted:

. '" title="'

Also, I want to thank you and the development team for your efforts in developing Coppermine.  Its a fantastic piece of software and you all should be proud!

Gordon

Nibbler


gldickens3

Quote from: NibblerWhy is your change required? GauGau's code looks correct to me.

Hi Nibbler,

Sorry!  You are apparently correct and GauGau's original code was apparently correct as well.

I have very little experience with php code other than the mods that I have made to my Coppermine installation.  When I first implemented GauGau's mods I was getting a broken image icon in the URL bar of the full size image when using IE.  So, I reapplied the mods with the change that I suggested and everything worked.  Now, since I read your post I retried the original code and it works fine so I must have dumb thumbed something the first time around.

Thanks for the correction.

Gordon