You know when you put an image on a website, and when you click on it and it's safe, it gets small and you can drag it right?
How do I not let the user drag or save an image? The instagram for example you can not save the image or drag it.
You know when you put an image on a website, and when you click on it and it's safe, it gets small and you can drag it right?
How do I not let the user drag or save an image? The instagram for example you can not save the image or drag it.
This is a suggestion based on my knowledge. There are probably other ways to do it.
1 - put the image as background and NOT with the tag <img>
. So:
<style>
.img {
background-image: url('imagem/minhaImagem.jpg');
width: 300px;
height: 300px;
}
</style>
<div class="img">
</div>
In this way it will not be able to drag the image, or copy it. However, he will be able to find his way.
2 - Block directory access for images with .htaccess
. You create a file with that name .htaccess within the directory you want to block access to. In the case of images . In this file, you enter the following code:
<Directory /imagens> // <-- é necessário colocar o nome do diretório
Options -Indexes
</Directory>
And all your images will be inaccessible.