On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • I wasn’t sure to post this.

    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.
    • There’s really no sure way to do that; the javascript can be circumvented. If something gets downloaded onto the visitor’s browser (which is the point of a web page, after all) they can save it if they really want to. As far as that goes, a screen capture will make anything you try to do useless.

      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.

        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
      • The best bet is to put a copyright over the image like istock do.
        • You can do a one frame flash movie with password protection.
          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...

          • Easier than a flashmovie but less safe would be using a transparent image.

            Now create a simple snippet:
            //set default base64 transparent image
            if(!isset($imgTr)) {
            //make image path unreadable
            function obfuscate($input, $par) {
              if($par) {
                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 {
            return $output;

            call it in your resource like this:

            [[hiddenImage? &imgPath=`assets/images/test.png`

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

            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;"/>

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