Re: Storing Images #2
| From: | Chris | Date: | Thu, 04 Feb 2010 21:55:48 +0000 |
| Subject: | Re: Storing Images #2 | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-46859@lists.php.net to get a copy of this message | ||
elk dolk wrote:
On 3 February 2010 16:07, wrote:Do you mean what url? You'll need a script to pull them from outside the document root. The advantage of this is you can do authentication checks before displaying the image. The disadvantage is the web-server isn't serving the images directly so there will be a slow down. So you point your images to getimage.php?image=123456 and getimage.php does your authentication checks if necessary then pulls the image back using something like http://www.php.net/fpassthru -- Postgresql & php tutorials http://www.designmagick.com/I currently have all my images referenced by url in my database and stored in a folder/s and I think I will keep it that way.................................................................If you put the images OUTSIDE of the webroot/docroot/public_htmlfolder (whatever you have), then a user cannot directly navigate to the file. e.g./home/sites/your_site/public_html/images/image1.jpghttp://www.yoursite.com/images/image1.jpg would probably work.But ... /home/sites/your_site/public_html/getImage.php /home/sites/your_site/hidden_images/image1.jpgNow, there is no way I can load image1.jpg from my browser. I have touse getImage.php, which I assume would require me to login or authenticate myself in some way. ---------------------------------------------------------- I have my photos in /public_html/img/gid directory and with this path: <img src='http://www.mydomain.com/img/{$gid}/{$photoFileName}' in getImage.php the server displays the photos. Now if I put my photos outside of the public_html like this: /hidden_images/img/gid what would be the correct path to the photos in the getImage.php script?