Reputation: 906
I have an uploads folder which is protected with htaccess file from public access:
deny from all
However I want to access this folder within my admin panel (using PHP) to show for example profile pictures of users.
How is it possible? Can I simply include the files?
Update :
to describe the situation a bit more accurate, I want to show profile pictures of users using img
tag, which tries to access pictures from browser and gets blocked. what should I put in src attribite?
Upvotes: 2
Views: 2223
Reputation: 906
I managed to do it using php. I created a php file image.php
:
header('Content-Type: image/jpeg');
readfile('path to protected image');
Then I used image.php
as src
attribute of img
.
Upvotes: 2