Can you block download? Can you block download?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Can you block download?

Started by twdmcrider, June 07, 2006, 08:18:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

twdmcrider

Can you block right click downloading of your pictures on Coppermine?  I know that someone could just do a print screen, but at least this would stop some from downloading images.  Thanks for your help.

Matt

Nibbler

Please read the docs and search the board before posting. Thankyou.

dke

#2
im wondering this aswell, ive searched and come up with nothing. Maybe im inserting the wrong query for search :/

EDIT: did some deeper searches and found this thread : http://forum.coppermine-gallery.net/index.php?topic=2450.0

but it seems none of these scripts work very well, any clue anyone know a good one that disable right click in all major browsers like explorer/firefox/opera ?

Sami

There is no way to block downloading,it's the nature of html if you disable righ click they will simply save entire page and then take the picture , if you open up pop up they will pick it from their "internet temp" (browser cache).
I think you can only water marking your image at all.
‍I don't answer to PM with support question
Please post your issue to related board

dke

ofcourse, but you _CAN_ make it harder for people :) i will only have rookies surfing my page anyway since its a closed community one, and i dont want them comming there dayly just to download images and leave...

I would be very happy if anyone could paste me / link me to a WORKING disable right click script for "displayimages.php" the rest dosnt matter, its the full size images i dont want people to download easly.

IVe searched and none of the scripts ive found so far seems to do just this, they just disable right click in the <body> of the template.html which dosnt really matter for me at all, if people wanna save thumbnails then go ahead!

Sami

This is a cross browser DHTML script that will prevent the default right menu from popping up when the right mouse is clicked on the web page.

<script language=JavaScript>
<!--

//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

var message="Function Disabled!";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")

// -->
</script>

Simply add the following code to the <BODY> section of your template.html
‍I don't answer to PM with support question
Please post your issue to related board

dke

#6
i cant test that right now, but im quiet sure this will only block "right click" on the actuall page, once you click a thumbnail and get transported by some javascript to a single window with a full size picture in it , you are able to right click in that window, maybe im wrong! ill test it when avaible and ill get back to ya! thanks

EDIT: just tested as you said, and it didnt work. This will ONLY disable right clicking on the actuall page, but once you click a image (thumbnail) and get "full size" you will be able to right click that image. Anyone else have any ideas?

Nibbler

To affect that page you'd need to add the code into a customised theme_display_fullsize_pic() function in your theme.php or into scripts.js.

dke

hmm thanks for the hint nibbler, any chance you could be more specific to what that code would look like?

or am i supposed to insert the script parameters inside the () ? sorry for these questions but im a complete newbie on php/html mysql and all this, i try, i try :)

Nibbler


// 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>
    <script language=JavaScript>
<!--

//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

var message="Function Disabled!";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")

// -->
</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
}

dke

#10
you sir, is amazing!! thank you alot for this, MUCH appriciated! thanks again, have a nice weekend :)

EDIT: on another note, is there anyway to implent this code into that code you just gave me?
<meta http-equiv="imagetoolbar" content="no" />

im sure you know what that does, is there anyway? I played around some with the code you wrote for me, but couldnt do it, any chance you could be of assistance? thanks alot again for your time & help!

Nibbler

Put it below the existing <meta> tag.

dke

thanks sir! works like a charm!