Jump to content

Display photos outside of web root


kurt.santo

Recommended Posts

Is there any way to display photos on a webpage, which have been stored outside of web root?
If you mean /.. then no, because external clients cannot access that, and they are the ones viewing the pictures. You could retrieve the image data on a PHP page and link to that, but what's the point?
Photo data stored in db.
You can store photo data in a database (use the BLOB data type).
Or how is it best to protect them?
Umm... how ever way you store them, when they are sent to the client they can always just right click and save as. So... there are things like water-marking and such, or you could make it a Flash file :) but whatever way you do it, people can always copy (e.g. through PrtScn). Though I did see a site once using high-frequency colour variation to make print-screened images look weird...
Link to comment
Share on other sites

you could store them a directory above the root, and use the php image functions to open them, possibly add a watermark as protection as synook said and use the created image to show instead

Link to comment
Share on other sites

You can store your images in a folder outside with the name and id in a database, and use include() if the user is allowed to view it.image.php

<?php  session_start();  $id=(int)$_GET['id'];  ...  ...  if($_SESSION['access']==1) {	header('Content-type: image/gif'); // Find MIME type of image to use	include('../../images/'.$file);  }?>

otherpage.php

<img src="image.php?id=1">

Link to comment
Share on other sites

You can store your images in a folder outside with the name and id in a database, and use include() if the user is allowed to view it.image.php
<?php  session_start();  $id=(int)$_GET['id'];  ...  ...  if($_SESSION['access']==1) {	header('Content-type: image/gif'); // Find MIME type of image to use	include('../../images/'.$file);  }?>

otherpage.php

<img src="image.php?id=1">

Thanks a lot for your input. Will try few of your suggestions and see what is best.Cheers:-)Kurt
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...