Welcome Guest, Not a member yet? Register   Sign In
Secure display image outside root
#1

(This post was last modified: 08-12-2016, 01:37 AM by Marcel.)

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
Reply


Messages In This Thread
Secure display image outside root - by Marcel - 08-12-2016, 01:36 AM
RE: Secure display image outside root - by PaulD - 08-12-2016, 12:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB