Re: Re: how to display images stored in DB
| From: | markw at mohawksoft dot com | Date: | Thu, 01 Mar 2007 03:08:20 +0000 |
| Subject: | Re: Re: how to display images stored in DB | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-249634@lists.php.net to get a copy of this message | ||
> On Wed, 2007-02-28 at 17:04 -0500, Mark wrote:
>> Kevin Waterson wrote:
>>
>> > This one time, at band camp, zerof <zerof@terra.com.br> wrote:
>> >
>> >> It is not a good practice to store pictures in DataBases, use links,
>> >> instead of.
>> >
>> > Rubbish, where are your benchmarks?
>>
>> It has almost nothing to do with benchmarks.
>>
>> Images are typically best supported in the form of files. They are more
>> easily manipulated by external tools.
>>
>> The web browser sees an image as a single HTTP request. Invoking the PHP
>> script engine, parsing the script, and executing a SQL query to retrieve
>> the image from the database is less efficient than letting the web
>> server
>> just send the file.
>>
>> Image files do not need to be constrained by the rigid requirements of a
>> relational database.
>>
>> I could go on, but it should be clear enough that putting images in a
>> database is not a good idea.
>
> What about when you need to share those files across a 50 node network?
Without more information about the nodes and the network design, I can't
offer a good argument against it, but I can say, that given any rational
system, bitmap images are better as discrete files than contents of a
database.
If you give me more information, I can counter with more specifics.
> I'd keep it in a database, then when I need it cache a local copy on the
> filesystem. Then I can just check the timestamp in the database to see
> if the file has changed. Voila, multi-node high availability images.
You can do that sort of operation with any number of other tools more
efficiently.
>
> Seems better than have a local copy of every single image. I guess the
> answer is... it depends on what you're doing!
No, it just seems like if the only tool you are comfortable with is a
hammer, then every job is more or less exactly like a nail.
Databases are great tools, but there are many tasks which they can do,
just not well.