Re: Re: jpg files in mysql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I 100% agree with Larry.

The file system is FAR better suited to handle images than a BLOB field 
in a database.

Larry Helms wrote:
>
> Only authorized persons should have direct access to the files - without using the browser 
> - there are ways (using apache) to make it such that you can't 'browse' images in a 
> directory.  
The most common way is to use URI pathings.

Create your images directory OUTSIDE of public_html/ or htdocs/ (or 
whatever config your host has for its document web root)

Ie,

/home/users/yourname/public_html/
is your webroot where your index.php file is located.

create

/home/users/yourname/safeimagedirectory/

Then, with simple simple mod_rewrite and a processing script, you can 
call <img src="/images/uniquefilename.jpg" /> which, to the user appears 
to be a real url, actually isn't.
use a condition and rule in htaccess to redirect all image requests to 
images.php, call it via the URI, and spit it back.



A good example of a free tool that does this is the popular Gallery 
software.  There are options on set up to place the store outside of 
public_html/


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux