Re: what is the best way of storing text+image documents in postgresql - Mailing list pgsql-general

From Radosław Smogura
Subject Re: what is the best way of storing text+image documents in postgresql
Date
Msg-id e2a58874cc3888048306bb2b77a2eb6e@mail.softperience.eu
Whole thread Raw
In response to what is the best way of storing text+image documents in postgresql  (Arash pajoohande <apajoohande@gmail.com>)
List pgsql-general
 On Wed, 8 Jun 2011 14:43:16 +0430, Arash pajoohande wrote:
> hello
> i have a lot of files in microsoft word format. each file consists of
> text and images (other text formatting like font is not important).
> i want to store this documents in Postgresql, and documents must
> display on web page when corresponding user requests occurs.
>
> it seems theres 2 way to do that:
> 1. save .doc documents in bytea columns. and show them with a word
> reader in web page (disadvantage: it needs a proper .doc reader
> installed on user computer)
> 2. convert document to html format and store html code as string
> (disadvantage: images will remain in file system)
>
> what is your offer? any help highly would be appreciated
>
> thanks in advance
> arash

 If you want to do 2. there is no problem your application should
 display documents like this
 /browswer/<document_id>/<start>.html

 Then after conversion put all generated files in database, converted
 document (start.html) should be relatively linked, if some browser will
 call to load image big/my_logo.png, then it will do request
 /browswer/<document_id>/html/big/my_logo.png

 Your CGI/Servlet will capture every request after /browser, you have id
 of document and requested file name passed in URL then do
 SELECT content where doc_id=... and filename='....'

 Caching, speed-uping, on demand generation, securing is on your side.

 Regards,
 Radek

pgsql-general by date:

Previous
From: Radosław Smogura
Date:
Subject: Re: Best Practices - Securing an Enterprise application using JBOSS & Postgres
Next
From: pasman pasmański
Date:
Subject: Re: plpgsql function with update and seeing changed data from outside during run