[UPHPU] Storing images in DB

TJ Hunter tjhunter at ruistech.com
Tue May 25 12:12:22 MDT 2004


The other way of accomplishing this is to have all the images saved on 
the file system outside of webroot, then have a php script that can 
validate availablity and if it's ok, sent the appropriate http header 
and then do a readfile().

I like to have all my images on the file system, for the simple fact 
that I can write a quick shell script to do something like some 
imagemagick command on all of them without having to pull them out of 
the database first.

District Webmaster wrote:

>I still think storing binary data in the database can be a good idea,
>even after reading the nifty article. While the artical made many good
>points, it's absolutist approach is (as absolutist aproaches generally
>are) an overly simplistic look at the problem. You can rarely trust any
>opinion that says things should always or never be a certain way.
>
>We have a system that requires certain files only be accessible at
>certain dates. If we kept those files on the disk, and had them
>available to the web server, they would always be available to anyone
>who knew or could guess the the URL -- unless we wrote a seperate system
>to either change the file attributes, or a seperate system to move files
>in and out of the web root. All of these are fine to do, but it assumes,
>that you have the ability to run php from a cron script -- which would
>require you to have the cgi version of php installed, either as your
>main installation or concurrently with the apache module version. All of
>this is a lot more pain than just using "select file_name, file_data
>from files_table where file_viewable_start_date >= CURDATE() and
>file_viewable_end_date <= CURDATE()"
>
>Understanding the possibilities helps you chose the right solution for
>your particular problem. Beware those who will tell you a particular
>programming methodology is always right or always wrong -- they have
>likely not considered all possibilities.
>
>Dave
>
>  
>
>>>>Ray Hunter <bigdog at venticon.com> 05/25/04 11:23 AM >>>
>>>>        
>>>>
>On Tue, 2004-05-25 at 10:58, Daniel Crookston wrote:
>  
>
>>An article on why this isn't necessarily a good idea:
>>http://www.yapf.net/faq.php?cmd=100&itemid=22
>>
>>    
>>
>>>Have you considered storing the image in the database? This helps
>>>      
>>>
>with
>  
>
>>>data portability and some security issues. You would want a blob
>>>      
>>>
>field
>  
>
>>>to store an image.
>>>      
>>>
>
>Not to mention you can have forms of data corruption that i have seen in
>the past. At one job we went down this road and it was extremely
>painful. We had the image in various sizes in the database, however, it
>turned out that by using php and converting on the fly was the simple
>solution. One thing that we did add to the mix was a dedicated image
>server that served up the images. We used a small web server to do that.
>
>Also I would suggest looking at what file system type you have and which
>would be the best for your set up. I tend to use reiserfs a lot for the
>stability.
>
>--
>Ray
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: list-unsubscribe at uphpu.org
>For additional commands, e-mail: list-help at uphpu.org
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: list-unsubscribe at uphpu.org
>For additional commands, e-mail: list-help at uphpu.org
>
>
>
>
>  
>



More information about the UPHPU mailing list