How to protect pictures and videos with PHP
Browser if you want to display a picture can be written like this:
But anyone in the browser input xxx.jpg can browse to this picture, but I want to let only the uploader himself can see this picture, other people do not see.
My idea is to write this:
Then in the picture.php judge is not the uploader himself, if it is fopen (xxx.jpg), and then fwrite out, but this way the uploader himself can not be cached when browsing the picture, and if it is a video file, fopen and Fwrite the cost of the server should be very large, how to achieve the above simple function? Thank you!
------Solution--------------------
Since picture.php can be judged in this case, it can also be judged in your list of realities.
Then just judge it directly on the list page, showing only the author's video
------Solution--------------------
. php? ...... Read the contents of the picture, as can be cached
As for video files, you should extend PHP execution time .... To be a media server, you have to worry about bandwidth.
------Solution--------------------
is not I, give not give IMG path?
Judging if I (login), IMG label output normal path, not output default path?
The server indicates a high pressure.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.