forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: dke on June 10, 2006, 10:16:21 pm

Title: Disable right click in theme.php or displayimage.php - need some hints!
Post by: dke on June 10, 2006, 10:16:21 pm
Hey all,

Im trying to apply no right click script to displayimage.php or theme.php im not sure which one is used when you click on a picture and you get "full size". I dont wanna disable right click on the normal page, i can easly do that though buy editing template.html, but how do i disable right click when you view the full size picture? Ive searched the forum ALOT and ive figured out that it was in 1.3.x in displayimages.php i was suppose to change somthing, but in 1.4.x it seems this was moved to theme.php? Anyone know a working one, that i could use? Ive tried this one, it works smoothly for template.html but dosnt do a thing for theme.php, maybe ive missed somthing, i need to add im a real rookie at this.

script i tested :

<script>
var isNS = (navigator.appName == "Netscape") ? 1 : 0;
if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
function mischandler(){
return false;
}
function mousehandler(e){
var myevent = (isNS) ? e : event;
var eventbutton = (isNS) ? myevent.which : myevent.button;
if((eventbutton==2)||(eventbutton==3)) return false;
}
document.oncontextmenu = mischandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;
</script>

Any help is appriciated, thanks!

EDIT: i should add that i use 1.4.8 the latest build.
Title: Re: Disable right click in theme.php or displayimage.php - need some hints!
Post by: Joachim Müller on June 11, 2006, 10:28:16 am
Edit themes/yourtheme/theme.php, find
Code: [Select]
function theme_display_fullsize_pic()If this function doesn't exist in your custom theme, paste
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";
               
?>

          </div>
        </td>
      </tr>
    </table>
  </body>
</html>
<?php
}
into a new line before
Code: [Select]
?>and edit as you see fit.

Sidenote: the dev team members strongly recommend not to use "no right-click" scripts as they are silly in the first place, won't keep determined users from stealing pics and will scare away many power-users who make proper and legitimate use of the browser's context menu. I strongly suggest reviewing the whole idea.
Title: Re: Disable right click in theme.php or displayimage.php - need some hints!
Post by: Joachim Müller on June 11, 2006, 10:36:27 am
In the future, don't double-post - you should have continued to post questions on your issues in the thread you hijacked (http://forum.coppermine-gallery.net/index.php?topic=32533.0) in the first place.

Watching the mousedown event is silly as well, I recommend triggering the script "oncontextmenu" if you must have it.
Title: Re: Disable right click in theme.php or displayimage.php - need some hints!
Post by: dke on June 11, 2006, 11:30:32 am
im sorry, wont happen again, thanks alot for your help though! sorry to have taken up valuable time of yours!

can put solved on this !
Title: Re: Disable right click in theme.php or displayimage.php - need some hints!
Post by: Stramm on June 11, 2006, 01:35:57 pm
I don't like disabling the right click also. And I don't visit sites that force me to do without the rmb.

So why not just edit your theme a lil bit and do how a lot of people suggest... display the image in the table as background and use a transparent gif as <img ... if a user right clicks -> save as he saves the transparent gif. Of course that won't stop experienced users (neither would disabling the rmb) but newbies. Lol, but I consider both beeing annoying

To check this out see sig and switch to the classic theme (implemented in normal and fullsized view)
Title: Re: Disable right click in theme.php or displayimage.php - need some hints!
Post by: SonjaSt on June 11, 2006, 04:32:13 pm

So why not just edit your theme a lil bit and do how a lot of people suggest... display the image in the table as background and use a transparent gif as <img ... if a user right clicks -> save as he saves the transparent gif. Of course that won't stop experienced users (neither would disabling the rmb) but newbies.

How can I do that?
If the gif is not blank but contains a copyright sign (watermark), would it still be possible for experienced user to steal the photos?

I ask this because right now I am putting a watermark on each of my photograph (see: http://www.sonjasteubesand.com/photogallery/displayimage.php?album=6&pos=90 ). It's easy to do but takes much time. It would be great to save that time.

Sonja
Title: Re: Disable right click in theme.php or displayimage.php - need some hints!
Post by: Sami on June 11, 2006, 05:17:41 pm
You can use his (stramm) mod to do watermarking on the fly
see Here (http://forum.coppermine-gallery.net/index.php?topic=16286.0)
Title: Re: Disable right click in theme.php or displayimage.php - need some hints!
Post by: SonjaSt on June 11, 2006, 07:37:47 pm
Thank you bmossavari.
I will try Stramm's mod.
Title: Re: Disable right click in theme.php or displayimage.php - need some hints!
Post by: Stramm on June 11, 2006, 08:29:19 pm
You can use his (stramm) mod to do watermarking on the fly
see Here (http://forum.coppermine-gallery.net/index.php?topic=16286.0)

it's a permanent watermark... no watermarking on the fly

@SonjaSt, no, a transparent gif with a watermrk as overlay image wouldn't protect your images from being stolen. An experienced user always can 'steal' your images as they are already stored on his computer as soon as he's viewing them.

For the modpack users I've posted a modified theme.php (the transparent gif overlay) http://forum.coppermine-gallery.net/index.php?topic=32548.0

I'll probably post a theme.php for non modpack users when I have some spare time
Title: Re: Disable right click in theme.php or displayimage.php - need some hints!
Post by: Sami on June 11, 2006, 08:37:40 pm
it's a permanent watermark... no watermarking on the fly
Sorry  :P my bad
Title: Re: Disable right click in theme.php or displayimage.php - need some hints!
Post by: SonjaSt on June 11, 2006, 09:32:28 pm
Hours later,...
I read the whole 14 pages of the thread bmossavari mentioned and found out that I can not use it. It's made for 1.3 and I am using 1.4.x

Stramm, is there a mod or plug-in avaliable for 1.4.x that adds a permanent watermark to the bigger pictures? (not for the thumbs)
Title: Re: Disable right click in theme.php or displayimage.php - need some hints!
Post by: Sami on June 11, 2006, 10:32:51 pm
search the board for "watermak" this is one and only way !
also you can install "Modpack" of stramm , it's 1.4.8 ver with great mod (+watermarking & disable right click)
sorry for your time.
Title: Re: Disable right click in theme.php or displayimage.php - need some hints!
Post by: Joachim Müller on June 12, 2006, 07:23:44 am
http://forum.coppermine-gallery.net/index.php?topic=29817.0 is for cpg1.4.x. After all, there's a whole sub-board dedicated to watermarking (http://forum.coppermine-gallery.net/index.php?board=33.0), please choose the one that fits for your purpose.
Title: Re: Disable right click in theme.php or displayimage.php - need some hints!
Post by: Stramm on June 12, 2006, 07:28:30 am
or already modified files... http://forum.coppermine-gallery.net/index.php?board=81.0