You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Tom Allen <to...@nonserviam.net> on 2001/10/09 23:32:59 UTC

Galleries/ModPerl/Images

I just caught the end of the discussion about Stonhenge::Pictures and 
Apache::Gallery ...
I have been working on setting up a photography site for myself and a 
few other digital photographers.  Is there a reason NOT to put the 
images in a database?  It certainly seemed to speed up pattern searches 
on my site.  The site is up in php right now (had to brush up for a 
job), but will be redev'd in mod_perl once I find out what the state of 
gallery management is for mod_perl.  
    I've used a MySQL backend to hold the images in BLOBs (I have a 
table for each of the common sizes).  Uploads go to a images table 
(original size) and then the database resizes so it doesn't have to do 
it on the fly.   Maybe those of us doing gallery type stuff could get 
together and work on something in a more organized fashion?



Re: Galleries/ModPerl/Images

Posted by Dave Hodgkinson <da...@davehodgkinson.com>.
merlyn@stonehenge.com (Randal L. Schwartz) writes:

> But agreed, it's slower to use an SQL interface to store images.  The
> filesystem makes a darn fine database, as long as you can get the
> resources into reasonable pathnames.

A certain network surveying company uses the filesystem to save stuff
and "locate" to find it again. Seems to scale to their needs too.

KISS.

-- 
David Hodgkinson, Wizard for Hire        http://www.davehodgkinson.com
Editor-in-chief, The Highway Star           http://www.deep-purple.com
All the Purple Family Tree news		      http://www.slashrock.com
   Interim Technical Director, Web Architecture Consultant for hire

Re: Galleries/ModPerl/Images

Posted by "Randal L. Schwartz" <me...@stonehenge.com>.
>>>>> "Perrin" == Perrin Harkins <pe...@elem.com> writes:

Perrin> 3) Most databases don't make dealing with BLOBs as simple as MySQL

(ahem) *and* modern PostgreSQL

Perrin> does, so your code becomes rather hard to port.

Modern PostgreSQL has column type "bytea", with encode/decode escaping
handled entirely by DBD::Pg.

But agreed, it's slower to use an SQL interface to store images.  The
filesystem makes a darn fine database, as long as you can get the
resources into reasonable pathnames.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<me...@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Re: Galleries/ModPerl/Images

Posted by Perrin Harkins <pe...@elem.com>.
> Is there a reason NOT to put the
> images in a database?

There are many.

1) You can't manipulate them with file-based tools any more.
2) Handling a request for an image consumes many more resources, since there
is now application code and a database involved rather than just a simple
static file request.
3) Most databases don't make dealing with BLOBs as simple as MySQL does, so
your code becomes rather hard to port.

Those are the biggies.  Of course there are reasons to do it too, but every
time I've put images/templates/files in a database I have lived to regret
it.  Storing the path seems to work better.

- Perrin