Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14348

Secure display image outside root

$
0
0
Hi all

i have my whole codeigniter placed outside my root except for the assets (css,js)

i use a php script to display my images in the view like so

Code:
<img class="img-circle" src="../image.php?img=me.jpg" alt="">


the image.php contents look like this

PHP Code:
<?php  

  header
('Content-Type: image/jpg');
  
readfile("../images/" $_GET['img']);
   
?>
I would like to prevent a non logged on user to link to my images using the url:

https://mydomaine.be/image.php?img=avatar.png


is there a way to do this.

i have tried placing code inside the image.php (if ci loggedinuser bla bla) but i dont have access to the CI core inside my image.php so dont work.
by the way the image.php is in the root. (http://www.mydomain.be/image.php)

what would be the best way to achieve this

thanks to all

Viewing all articles
Browse latest Browse all 14348

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>