How to Make Images Secure on a Website

Save

There are lots of reasons to want to make sure images on your website are secure. Perhaps you want to share pictures of your family, but you don’t want other people saving them. Or maybe you are a photographer and you want to avoid having your copyright violated. Whatever your reason, there are a few steps you can take to protect your images. The only fail-proof strategy, however, is to not put the images online.

  • Place a blank index file in your images folder. Go to your website’s control panel and open the folder where you save the images for your website. Insert a blank index.html or index.php file. This prevents people from going directly to your image folder and scrolling through every image you have saved.

  • Copy and paste the following code into the <HEAD> section of each web page. This code will disable the ability for people to right-click and save images. <br /><br /><SCRIPT TYPE=\"text/javascript\"><br /><!--<br />//Disable right click script<br />//This disables people from right clicking<br />var message=\"Sorry, right-click has been disabled\"<br />GO<br />///////////////////////////////////<br />function clickIE() {if (document.all) {(message);return false;}}<br />function clickNS(e) {if<br />(document.layers||(document.getElementById&&!document.all)) {<br />if (e.which==2||e.which==3) {(message);return false;}}}<br />if (document.layers)<br />{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}<br />else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}<br />document.oncontextmenu=new Function(\"return false\")<br />// --><br /></SCRIPT>

  • Hide your source code. If a user clicks on \"View\" and chooses \"Source\" at the top of his browser, he can see all of the coding for a particular web page, including the image URLs. All a user has to do is go directly to the URL and save the image. Avoid this by going to your web page’s source and finding the first tag that says <html>. Put your cursor in front of that tag and keep hitting enter. Save the changes. This won’t completely hide the source, but it will push it down so far out of view that most will think that you don’t have any source code.

  • Test your website. Go to your website and view all of the pages to make sure you added the code correctly. If any code is showing up as text, then you did not insert it in its entirety. Also, test to see if the copy and paste, and view source functions are still enabled.

Tips & Warnings

  • If you have a static website, where you upload each html page separately, you will have to copy and paste the javascript, and hide the source on each page you want to protect. If you have a dynamic website, for example a Wordpress blog or other content management system, you only have to change the template one time and it will apply to your entire site.
  • No technique is able to make an image 100-percent secure. If someone really wants to have one of your images, they will find a way to bypass any protective measures you put in place. <br /><br />Disabling right-click can frustrate some users and may discourage them from coming back to your site, as there are legitimate reasons to right-click such as going back and fourth between pages and adding a page to your bookmarks.

References

  • Photo Credit Jupiterimages/Comstock/Getty Images
Promoted By Zergnet

Comments

You May Also Like

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!