Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Storing images in SQL database?
On 5 Oct 2004 13:38:04 -0500, Galen Boyer <galenboyer_at_hotpop.com> wrote:
>On Tue, 05 Oct 2004, recneps.w.divad_at_elcaro.moc wrote:
>>
>> Galen Boyer wrote:
>>> On Tue, 05 Oct 2004, andy_at_andyh.co.uk wrote:
>>>
>>>> As for it being harder to use in a web environment,
>>> I'd like to hear the explanation of this.
>>
>> Compare:
>>
>> [img src="/srv/www/htdocs/image.png"]
>>
>> with
>>
>> [img src="SELECT IMAGE FROM IMAGE_TABLE"]
>>
>> One of them probably won't work.
>
>But, you already have access to the database, so use that layer
>and issue:
>
> select picture from tbl where id = ?;
>
>where the table is:
>
> create table image_tbl(
> id number
> ,picture blob);
>
>What's the issue?
The slight awkwardness is that is has to be in a separate request; you output an <img> tag in the HTML output pointing to the resource for the image, you don't output the image data in the page.
So it has to be something like
<img src="/thingy/that/serves/image?id=whatever">
... and that other page then serves up the image. So it's in a different session and transaction. Not much of an issue, though.
-- Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk> <http://www.andyhsoftware.co.uk/space> Space: disk usage analysis toolReceived on Tue Oct 05 2004 - 13:44:07 CDT