Pictures in php are not allowed to be accessed by http.

is my site. I want users to have normal access to personal avatars, but I don"t want some people to steal their avatars

I have tried to forbid traversing the directory where the picture is located, and give up this method for special reasons. I found a case in Baidu and Google where image forbids http access (I think it is an introduction). I do not understand this method, so I have come here to ask for help. I am a novice and I really do not understand it. I also ask you to lend a helping hand.

Php
May.10,2021

a.gif can be accessed by the network
then a can access b can't access http is a stateless protocol you have no idea who is accessing yourself
unless all the pictures in your site are relocated to a program through nginx location, and then decide whether to display the picture
but based on whether the user is the local user or not. It is really strange that
can do this

.
location /showimg/ {
     -sharp[config] 
}

location ~* \.(gif|jpg|jpeg)$ {
        rewrite (.*) /showimg/$1 last;
}

you mean hotlink protection, check hotlink protection, mainly by checking the ref of the http header to determine the source

Menu