<![CDATA[ Something which prevents people from stealing photos please - My Forums]]> https://forums.modx.com/thread/?thread=48993 <![CDATA[Re: Something which prevents people from stealing photos please]]> https://forums.modx.com/thread/48993/something-which-prevents-people-from-stealing-photos-please#dis-post-286251
Now create a simple snippet:
<?php
//set default base64 transparent image
if(!isset($imgTr)) {
  $imgTr='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCB1jYAAAAAIAAc/INeUAAAAASUVORK5CYII=';
}
//make image path unreadable
function obfuscate($input, $par) {
  $output=$input;
  if($par) {
    $output='';
    for($i=0;$i<strlen($input);++$i) {
      $n=rand(0, 1);
      if($n) {
        $output.=chr(38).'#x'.sprintf("%X", ord($input {$i})).';';
      } else {
        $output.=chr(38).'#'.ord($input {$i}).';';
      }
    }
  }
  return $output;
}
if(isset($imgPath)and!isset($obfusc)) {
  $output='<img src="'.$imgTr.'" style="background: url('.$imgPath.') no-repeat 0 0; width:'.$imgWidth.'px; height:'.$imgHeight.'px;"/>';
} elseif(isset($id)) {
  $output='<img id="'.$id.'" src="'.$imgTr.'" style="width:'.$imgWidth.'px; height:'.$imgHeight.'px;"/>';
} elseif(isset($obfusc)) {
  $output='<img src="'.$imgTr.'" style="background: url('.obfuscate($imgPath, $obfusc).') no-repeat 0 0; width:'.$imgWidth.'px; height:'.$imgHeight.'px;"/>';
} else {
  $output='';
}
return $output;



call it in your resource like this:

[[hiddenImage? &imgPath=`assets/images/test.png`
               &obfusc=`1`
               &imgWidth=`230` 
               &imgHeight=`80` 
               &imgTr=`assets/images/transparent.png`
]]

or if you set the background image in css.
#myimage{
 background: url(assets/images/test.png) no-repeat 0 0;
}

[[hiddenImage? 
   &id=`myimage` 
   &imgTr=`assets/images/transparent.png`
   &imgWidth=`230`
   &imgHeight=`80`
]]


Now when the user tries to right click and download the image he/she will download a transparent image. Inspecting the source will show either an id or a obfuscated path to an image.

<img id="myimage" src="assets/images/transparent.png" style="width:230px; height:80px;"/>

or
<img src="assets/images/transparent.png" style="background: url(assets/images/test.png) no-repeat 0 0; width:230px; height:80px;"/>

or if no transparent image is set:
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCB1jYAAAAAIAAc/INeUAAAAASUVORK5CYII=" style="background: url(assets/images/test.png) no-repeat 0 0; width:230px; height:80px;"/>

This of course won’t stop a clever user but will most certainly discourage John Doe.]]>
stofke72 Oct 25, 2010, 02:13 PM https://forums.modx.com/thread/48993/something-which-prevents-people-from-stealing-photos-please#dis-post-286251
<![CDATA[Re: Something which prevents people from stealing photos please]]> https://forums.modx.com/thread/48993/something-which-prevents-people-from-stealing-photos-please#dis-post-286250 You can’t download it with right click, if someone gets the movie he can’t open it because of the password.
I did that once years ago for an artist, worked great...

LordRayden
]]>
LordRayden Jul 18, 2010, 03:26 AM https://forums.modx.com/thread/48993/something-which-prevents-people-from-stealing-photos-please#dis-post-286250
<![CDATA[Re: Something which prevents people from stealing photos please]]> https://forums.modx.com/thread/48993/something-which-prevents-people-from-stealing-photos-please#dis-post-286249 paulp Jun 27, 2010, 03:43 AM https://forums.modx.com/thread/48993/something-which-prevents-people-from-stealing-photos-please#dis-post-286249 <![CDATA[Re: Something which prevents people from stealing photos please]]> https://forums.modx.com/thread/48993/something-which-prevents-people-from-stealing-photos-please#dis-post-286248
Certainly there is no way to do anything from the server (where MODx works). Once the page is passed on to the server to be sent to the visitor, MODx is no longer involved.

]]>
sottwell Jun 27, 2010, 03:36 AM https://forums.modx.com/thread/48993/something-which-prevents-people-from-stealing-photos-please#dis-post-286248
<![CDATA[Something which prevents people from stealing photos please]]> https://forums.modx.com/thread/48993/something-which-prevents-people-from-stealing-photos-please#dis-post-286247
I am wondering if MODX provides a module, snippet, etc, which prevents visitors to a website, from right clicking, so nonone can save the photos to their computer, which are on the website. My client needs a something on their website, which prevents people from stealing their product ideas. I know that there is a JavaScript script, but I thought that may be MODX has something like that. Thanks in advance.]]>
bluegum Jun 26, 2010, 10:23 PM https://forums.modx.com/thread/48993/something-which-prevents-people-from-stealing-photos-please#dis-post-286247