I let users upload images to a specified folder.
Now I want to show the images when they are accessed from the source code, but not via url. So nobody should be able to access the images via url, like domain.de/images/img1.jpg.... How can I do that?
I let users upload images to a specified folder.
Now I want to show the images when they are accessed from the source code, but not via url. So nobody should be able to access the images via url, like domain.de/images/img1.jpg.... How can I do that?
Place the images in a directory whose content cannot be accessed directly via URL (in this case forbid access to images/)
When you have to serve one of them send the correct header for the image type, read the image from disk and send it to the client
header( 'Content-Type: image/jpeg' );
readfile( $pathToTheImage );