Re: yet another image: db or filesystem ? question

From: Richard Huxton <dev(at)archonet(dot)com>
To: Rick Schumeyer <rschumeyer(at)ieee(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: yet another image: db or filesystem ? question
Date: 2007-07-17 15:31:34
Message-ID: 469CE0D6.3060504@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Rick Schumeyer wrote:
> I've read the earlier threads on whether to store images in the database
> or filesystem. I think I understand the pros and cons of each method,
> but I have a question on a specific use case.
>
> Let's say I have a web app, and I want to display the images in a web page.
>
> a) if the images are in the filesystem (and also under the web root), no
> problem. Just use <img src="filename.jpg" />
>
> b) if the images are in the database...do I need to create a temporary
> file first in order to use the <img> tag? Or is there some other HTML
> way of doing this?

You can map it via a script: <img src="/foo/myimg.php?id=123">
Then have myimg.php read the image data for 123 from the DB and return it.

This is almost certainly much slower than just streaming the image from
the filesystem. However, cacheing effects might mean you don't care.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message mljv 2007-07-17 15:33:29 Re: createing indexes on large tables and int8
Previous Message Rick Schumeyer 2007-07-17 15:09:33 yet another image: db or filesystem ? question