I have a site and blog, the pictures are stolen from them, I want a simple code to disallow of my files to view on other sites.
Do you mean that people are copy and pasting your images from your site? You can stop less technical users from stealing images by using a script that disallows right clicking, or covering images with a different element, though users may find these features annoying. You could also watermark your photos with your website address so people might not want to copy them. If you are instead referring to image "leeching" or "hotlinking", where other website owners use the image hosted on your site to serve it on their own (Like using an img tag with your web address as the src image), there are less solutions. One solution would to be to host your images on a different server and serve them from there instead, like uploading the images to imgur or a similar service. You could also use modifications to your .htaccess to prevent this. I used to use this solution but am unsure if it still works.
(Do you mean that people are copy and pasting your images from your site?) (You could also use modifications to your .htaccess to prevent this.) Yeah.. I mean this ..
The most effective way I found is save it as base64 png image. Use PHP to save base64 string as png image. When you want to use the image just call it with base64_decode function. This way, image downloaded from your site will be useless for anyone with no clue. It doesn't prevent screen capture anyway. This topic on stackoverflow may give you some idea: How to save a PNG image server-side, from a base64 data string Sorry for not linking, I think some post with link has been taken off from this site.
I won't use .htaccess unless I want my site performance drop. If you use NGINX, there might be exception for that, but I don't know. By the way, I think PHP is far easy than .htaccess and without a nasty side effect.
i am using cloudflare without security settings (because of that stupid captchas) but performance and optimizations are the best. And i am not using plugins, just add site to the cloudflare and change nameservers on domain register.
Add your site on cloudflare. Change nameservers to point to cloudflare. Disable other options than Hotlink (this is under security settings).
Or just use and external image host: http://imgup.io/ and embed the images on your site Or, htaccess: RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC] RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L] Code (markup):