Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Disabling Right Click on pop up Image


keress

Recommended Posts

My client wants me to disable right-clicking on his images. (He doesn't think most of his competitors likely to steal his images are savvy enough to figure out a way around the disabling.)

 

I've done so on most of the pages, except the pop ups (to give an enlarged view). The only scripts I can find are for within an html page, these are not. Anybody know how to do this?

Link to comment
Share on other sites

hmmm, the popup is still an html page. Do the code in popup_image.php and it should work fine.

Please note - if I have suggested a contrib above, it doesnt mean it will work! Most of the contribs are not ones I've used, but may be useful for your particular problem....

Have you tried a refined search? Chances are your problem has already been dealt with elsewhere on the forums.....

if (stumped == true) {

return(square_one($start_over)

} else {

$random_query = tep_fetch_answer($forum_query)

}

Link to comment
Share on other sites

hmmm, the popup is still an html page. Do the code in popup_image.php and it should work fine.

 

Thanks for replying. I just tried that, and it didn't work. The pop up opens in a new window, with no source code, it's just a url to the image, which seems to be making the difference.

Link to comment
Share on other sites

OK, think you must have seriously played with your popup image file, 'cos in the default download its definitely creates an html type page with code and all. The only diff I can think of is that it doesnt call the header file, which may be where you have part of your code for the disable click.

 

It is definitely do-able, and definitely the only place to do it is in popup_image.php!

Please note - if I have suggested a contrib above, it doesnt mean it will work! Most of the contribs are not ones I've used, but may be useful for your particular problem....

Have you tried a refined search? Chances are your problem has already been dealt with elsewhere on the forums.....

if (stumped == true) {

return(square_one($start_over)

} else {

$random_query = tep_fetch_answer($forum_query)

}

Link to comment
Share on other sites

Here's the code for my popup_image.php

 

<?php
/*
 $Id: popup_image.php,v 1.18 2003/06/05 23:26:23 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 $navigation->remove_current_page();

 $products_query = tep_db_query("select pd.products_name, p.products_image from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and pd.language_id = '" . (int)$languages_id . "'");
 $products = tep_db_fetch_array($products_query);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo $products['products_name']; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<script language="javascript"><!--
var i=0;
function resize() {
 if (navigator.appName == 'Netscape') i=40;
 if (document.images[0]) window.resizeTo(document.images[0].width +30, document.images[0].height+60-i);
 self.focus();
}
//--></script>
</head>
<body onload="resize();">
<?php echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name']); ?>
</body>
</html>
<?php require('includes/application_bottom.php'); ?>

Link to comment
Share on other sites

Here's the code for my popup_image.php

<script language="javascript"><!--

var i=0;

function resize() {

?if (navigator.appName == 'Netscape') i=40;

?if (document.images[0]) window.resizeTo(document.images[0].width +30, document.images[0].height+60-i);

?self.focus();

}

//--></script>

How about if you insert your script to disable right click right before the existing <script> statement in popup_image.php? That should do it.

Link to comment
Share on other sites

While you can disable right clicks, what's to prevent users from just moving the mouse pointer over the image, then click on the image of the floppy disk (SAVE) to save the image? Can you also disable this SAVE icon?

Link to comment
Share on other sites

While you can disable right clicks, what's to prevent users from just moving the mouse pointer over the image, then click on the image of the floppy disk (SAVE) to save the image?  Can you also disable this SAVE icon?

What I've done in some sites is put a layer with a transparent image over the image I want to protect. Not 100% but will mean when they right click they get a blank image not the one I want to protect.

Link to comment
Share on other sites

I've tried adding the script in the popup_image.php file and it doesn't work. From the code it appears to be generating an html page, but in reality it's just calling up the url for the image. The code doesn't work to disable right clicking.

 

Other than adding a transparency with our name on it, anybody know of anything else I could try?

 

Thanks for the help

Link to comment
Share on other sites

I have a question, what script do I put where in order to disable right-clicking on the images on my normal .html pages. I've been looking for this answer and thought you would know since it sounds like you've already done so. Thanks for your help!

 

Holly

Link to comment
Share on other sites

as long as the html contains the link to the image it can be downloaded one way or another(just use one of the thousands available page parsers)

 

To protect it in some way you will have to add some sort of active scripting around the image links. Then the seo cannot see it and the users will have to run the script in order to see the image through their browser.

Link to comment
Share on other sites

I just Googled "disable right click image"? and got this page:

 

http://www.dynamicdrive.com/dynamicindex9/noright2.htm

 

Nice one thanks... Do you know where i can put the right click code, so it will work with all & just the the pop up images.. It may be annoying to put it on every image...

 

Also trying to sort out the placement & size of the pop up image on the screen - I've tried a few things, but end up mucking somthing else up on the way... Anyone know know which codes to alter.. I've just started using the CRE loaded new version - the link on their file manager doesn't seem to alter the pop up size as it says it should.. Anyone know.. I'm sure it's a wiz when you've done it before..

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...