Re: Inserting images to Database
| From: | Soeren Staun-Pedersen | Date: | Fri, 01 Sep 2000 19:55:10 +0000 |
| Subject: | Re: Inserting images to Database | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-14867@lists.php.net to get a copy of this message | ||
> >From a programming point-of-view, this model is much cleaner. You
> treat the data as any other data being inserted into the database.
> Then you don't worry about file names, file permissions, removing
> files upon a delete, overwriting, etc.
Perhaps true, but it depends on how you look at it.. if you totally ignore
that you mistreat the database by inserting data which _no_ LIKE or RLIKE
can possible understand (select * from images where picture LIKE '%cows%'),
perhaps it is a a pretty solution.
> >From the database point-of-view, this may not be so nice since
> the table can grow to enourmous proportions, slow up queries,
> possibly corrupt data, etc.
Exactly, I couldn't agree more. If you do an Image class in php, which on
a delete() call handles the files and updates the database, f.ex. this is
nicely wrapped away, and shouldn't break very easily. Plus you get an
amazing speed compared to fetching blobs out of a database.
It's a 10% nicer for the programmer to misuse the database, and 200% more
poor design in my oppinion (and I tried both approaches, and heard a lot
of people who regretted the pictures-into-database-and-blow-up-my-tables-
solution).
Cheers,
Soeren Staun-Pedersen - staun@netwarriors.org
------
"The internet is full, beat it"
- Me.