description and name in popup description and name in popup
 

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

description and name in popup

Started by montoya701, June 20, 2006, 05:28:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

montoya701

Is it possible and how to have name and desription(with that picture) in popup. It would be nice if there is somethnig like a template page for popup so it could be edited.

thanks

Paver

#1
The template function for the popup is theme_display_fullsize_pic.  If you don't have it in themes/yourtheme/theme.php, then copy the whole function from the sample theme and edit to your liking.

edit: To add the name and description, you can use the query results already grabbed in the function and stored in $row.  The name is the field 'title' and the description is the field 'caption'.  For example, modify the content block as shown, adding the last two echo lines:
              <?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";
                echo 
$row['title']."<br />\n";
                echo 
$row['caption']."<br />\n";
               
?>

montoya701

sorry man, but i don't understand you.
I find code for opening thumbs in fullsize popoup(theme.php in template),but what shoud i do with theme_display_fullsize_pic. where to put in theme.php code?

Vargha

Paver edited his post, read again
u put the 'theme_display_fullsize_pic'
in your themes/yourtheme/theme.php
below the ?>
Haalaa Boro Ye Chayi Vasam Dorost Kon Ta Man Ye Fekri Be Halet Bokonam ;) Ye Hendooneye Shotoriham Biyar Bizahmat :)
Visit My Site www.Rangarang.co.nr
Check Out My Gallery
www.Rangarang.co.nr/buddies
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fimg157.imageshack.us%2Fimg157%2F838%2Frangarang4xn.jpg&hash=48b4c3087515cafe09fc6d3f7ee19dce86328d8e)

Paver

As Vargha said, all variables and functions you want to customize should be copied from the sample theme.  You can copy them anywhere in your theme.php, but you need to make sure you do it properly for PHP (and not put a function inside another function for example).  If you don't know PHP well, the easiest thing to do is to always copy the new variable or function at the very end, before the last line: ?> - as Vargha said.

montoya701

ok, thanks

i just start editing. i'll let you known soon what i done

montoya701

it looks i am an idiot, but i'm not. i known how to edit php but it's problem i don't known yet how it works (this gallery).
When i paste this code in theme.php(at the end) i get (javascript close window) like a error in top of template.

All i have to do is to edit theme.php, nothing else?

Paver

Yes, you only edit one file: themes/yourtheme/theme.php.

If you want to start over, recover the original theme.php from the theme you are using.  Then copy the code below into the file, at the very end, just before the last line: ?>
// 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>
  <title><?php echo $CONFIG['gallery_name'?>: <?php echo $lang_fullsize_popup['click_to_close'];
      
?>
</title>
  <meta http-equiv="content-type" content="text/html; charset=<?php echo $CONFIG['charset'] == 'language file' $lang_charset $CONFIG['charset'?>" />
  <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";
                echo 
$row['title']."<br />\n";
                echo 
$row['caption']."<br />\n";
               
?>

          </div>
        </td>
      </tr>
    </table>
  </body>
</html>
<?php
}

This is the entire function, including the two lines I added to the default function.  Once you see that working, you can modify those two lines as desired, making sure to obey PHP syntax rules.

montoya701

that's it. Thanks Paver for solving my problem(like "pimp my ride" :)) )

This problem is officially SOLVED.

Joachim Müller


DaDragonPrincess

I don't get it myself, I also wants to custimize my pop up window for images,but don't know where to find the coding for it. Where do we go to find it, do we go under themes? Where do we find themes/yourtheme/theme.php and etc?

Joachim Müller

Quote from: DaDragonPrincess on July 11, 2006, 04:10:24 AM
Where do we find themes/yourtheme/theme.php and etc?
Inside the themes folder, there are several themes by default (e.g. classic, igames, water_drop). One of those themes is the theme you are using. This is what we refer to as "yourtheme", so if you are using a theme named "foobar", the file you need to edit themes/foobar/theme.php. If this is too complicated for you I suggest finding some paid help.

DaDragonPrincess

Ok I'm under the theme i'm using and this is all thats there,nothing of what you just mention:

../ Up a Level 4.00k 755  Jun 20 12:44 2006 princess princess 
images 4.00k 755 Protect
Rename Jun 20 12:44 2006 princess princess 
style.css 11.5k 644 Edit
Rename
Copy Jul 11 06:34 2006 princess princess 
template.html 1.63k 644 Edit
Rename
Copy Jul 10 08:44 2006 princess princess 
theme.php

Nibbler