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: Disable right click in theme.php or displayimage.php - need some hints!  (Read 9488 times)

0 Members and 1 Guest are viewing this topic.

dke

  • Guest

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.
« Last Edit: June 11, 2006, 02:04:56 pm by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de

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

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de

In the future, don't double-post - you should have continued to post questions on your issues in the thread you hijacked in the first place.

Watching the mousedown event is silly as well, I recommend triggering the script "oncontextmenu" if you must have it.
Logged

dke

  • Guest

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

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt

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)

SonjaSt

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 47


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
Logged

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project

You can use his (stramm) mod to do watermarking on the fly
see Here
Logged
‍I don't answer to PM with support question
Please post your issue to related board

SonjaSt

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 47

Thank you bmossavari.
I will try Stramm's mod.
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt

You can use his (stramm) mod to do watermarking on the fly
see Here

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

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project

it's a permanent watermark... no watermarking on the fly
Sorry  :P my bad
Logged
‍I don't answer to PM with support question
Please post your issue to related board

SonjaSt

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 47

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

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project

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.
Logged
‍I don't answer to PM with support question
Please post your issue to related board

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de

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, please choose the one that fits for your purpose.
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Pages: [1]   Go Up
 

Page created in 0.025 seconds with 19 queries.