Advanced search  

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]

Pages: [1]   Go Down

Author Topic: description and name in popup  (Read 8023 times)

0 Members and 1 Guest are viewing this topic.

montoya701

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
description and name in popup
« on: June 20, 2006, 05:28:28 pm »

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
« Last Edit: June 20, 2006, 10:32:46 pm by GauGau »
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: description and name in popup
« Reply #1 on: June 20, 2006, 05:29:26 pm »

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:
Code: [Select]
              <?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";
               
?>
« Last Edit: June 20, 2006, 05:42:07 pm by Paver »
Logged

montoya701

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: description and name in popup
« Reply #2 on: June 20, 2006, 05:44:09 pm »

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?
Logged

Vargha

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 223
  • Persian Soldier
    • Rangarang
Re: description and name in popup
« Reply #3 on: June 20, 2006, 05:52:45 pm »

Paver edited his post, read again
u put the 'theme_display_fullsize_pic'
in your themes/yourtheme/theme.php
below the ?>
Logged
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
(http://img157.imageshack.us/img157/838/rangarang4xn.jpg)

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: description and name in popup
« Reply #4 on: June 20, 2006, 06:00:23 pm »

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.
Logged

montoya701

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: description and name in popup
« Reply #5 on: June 20, 2006, 06:19:15 pm »

ok, thanks

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

montoya701

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: description and name in popup
« Reply #6 on: June 20, 2006, 06:39:11 pm »

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?
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: description and name in popup
« Reply #7 on: June 20, 2006, 07:08:02 pm »

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: ?>
Code: [Select]
// 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.
Logged

montoya701

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: description and name in popup
« Reply #8 on: June 20, 2006, 08:28:49 pm »

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

This problem is officially SOLVED.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: description and name in popup
« Reply #9 on: June 20, 2006, 10:32:17 pm »

below the ?>
should read
Quote
before ?> into a new line
Logged

DaDragonPrincess

  • Coppermine newbie
  • Offline Offline
  • Posts: 18
Re: description and name in popup
« Reply #10 on: July 11, 2006, 04:10:24 am »

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?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: description and name in popup
« Reply #11 on: July 11, 2006, 07:21:54 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.
Logged

DaDragonPrincess

  • Coppermine newbie
  • Offline Offline
  • Posts: 18
Re: description and name in popup
« Reply #12 on: July 11, 2006, 09:58:28 pm »

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
Logged

Nibbler

  • Guest
Re: description and name in popup
« Reply #13 on: July 11, 2006, 11:10:11 pm »

theme.php is right there  ::)
Logged
Pages: [1]   Go Up
 

Page created in 0.026 seconds with 19 queries.