I am using Lightbox to show the large version if images on my site. I want to add oncontextmenu="return false" to the <img> tag for all large images. how do I do this with Lightbox?
Printable View
I am using Lightbox to show the large version if images on my site. I want to add oncontextmenu="return false" to the <img> tag for all large images. how do I do this with Lightbox?
You dont want users to save images?
Nope! It's a photography site. :)
The thing is, there is no way to prevent users from doing that at all, it can only work for novice computer users who do not know how to work around this.
You may read this for more info:
http://javascript.about.com/library/blnoright.htm
If you still want to do it, let us know.
Yeah, I've read a bunch of stuff on this. All I want to do is disable right click on the large images only. What is need to know is Which file has the <img> tag for the large image links? Keeping in mind I am using the Zen Lightbox addon. All I want to do is putin the <IMG> tag for the large images.Code:oncontextmenu="return false"
Can anyone help me please? I'm just trying to figure out where the <IMG> tag is for the large product photos. I have Zen Lightbox installed, and I need to edit the <IMG> tag.
there are 2 files you want to check: 1 in the modules, and another in the templates folder. The files names contain something like this: main_product_image.
I have spent a couple hours looking through all the files that might be related.
I found this in tpl_modules_main_product_image:
But this just generates the 'larger image' link that shows a lightbox with the large image. What I need to edit is the <IMG> tag that lightbox uses to show the large image.Code:if (ZEN_LIGHTBOX_STATUS == 'true') {
echo '<script language="javascript" type="text/javascript"><!--
document.write(\'<a href="' . zen_lightbox($products_image_large, addslashes($products_name), LARGE_IMAGE_WIDTH, LARGE_IMAGE_HEIGHT) . '" oncontextmenu="return false" rel="lightbox[gallery]" title="' . addslashes($zen_lightbox_products_name) . '">' . zen_image($products_image_medium, addslashes($products_name), MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT) . '<br /><span class="imgLink">' . TEXT_CLICK_TO_ENLARGE . '</span></a>\')//--></script>';
} else {
echo '<script language="javascript" type="text/javascript"><!--
document.write(\'<a href="javascript:popupWindow(\\\'' . zen_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $_GET['products_id']) . '\\\')" oncontextmenu="return false">' . zen_image($products_image_medium, addslashes($products_name), MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT) . '<br /><span class="imgLink">' . TEXT_CLICK_TO_ENLARGE . '</span></a>\')//--></script>';
Here is some sample source code:
The highlighted code is a link to the large image. I need this image to have theCode:<!-- bof Zen Lightbox v1.4 aclarke 2007-09-15 -->
<script language="javascript" type="text/javascript"><!--
document.write('<a href="images/floral/a_bucket_of_sun.jpg" oncontextmenu="return false" rel="lightbox[gallery]" title="A Bucket of Sun"><img src="bmz_cache/e/ed5a7180c0d95ab16982d572a69bc0cd.image.93x120.jpg" alt="A Bucket of Sun" title=" A Bucket of Sun " width="93" height="120" /><br /><span class="imgLink">larger image</span></a>')//--></script><!-- eof Zen Lightbox v1.4 aclarke 2007-09-15 -->
<noscript>
<a href="http://throughmylensphotography.com/index.php?main_page=popup_image&pID=1" target="_blank"><img src="bmz_cache/e/ed5a7180c0d95ab16982d572a69bc0cd.image.93x120.jpg" alt="A Bucket of Sun" title=" A Bucket of Sun " width="93" height="120" /><br /><span class="imgLink">larger image</span></a></noscript>
</div><!--eof Main Product Image-->
property.Code:contextmenu="return false"
This is the CSS tree for the element that holds the large image:
Can I add theCode:html > body #productinfoBody > div #lightbox > div #outerImageContainer > div #imageContainer > div #hoverNav
to that CSS element?Code:contextmenu="return false"
All I want to do is disable the right-click menu on the large images.
Any LightBox experts that can help me with this? :)
I was looking for the same answer here...in the end I found it out myself :cool:
you should go to :
includes/templates/(your template)/popup_image/tpl_main_page.php
just add oncontextmenu="return false" in the body id:
:clap:PHP Code:
<body id="popupImage" class="centeredContent" onload="resize();" oncontextmenu="return false">