Re: Blobs with perl

Поиск
Список
Период
Сортировка
От Rudi Starcevic
Тема Re: Blobs with perl
Дата
Msg-id 3EEFA1CB.20303@oasis.net.au
обсуждение исходный текст
Ответ на Re: Blobs with perl  (Jonathan Gardner <jgardner@jonathangardner.net>)
Список pgsql-sql
Hi,<br /><br /> For not so big applications you could consider converting the binary image/file into text, using
base64,then store the resulting text.<br /> For example I have an app. where each member may have one or two images on
theiraccount.<br /> So when the user upload's their image I base64 it and store the text.<br /> Then when we need to
seethe image select the text and decode it back to binary format.<br /><br /> It work's well for me.<br /> This way
onlytext is stored. It's also handy as you don't need to worry about file name's being the same.<br /> It will increase
thefile size by about 30%.<br /><br /> Search the web for base64 example's, I'm sure you'll find examples to work
with.<br/> You can email me off list if you like to see some PHP code which does this.<br /><br /> Cheers<br />
Rudi.<br/><br /><br /><br /><br /> Jonathan Gardner wrote:<br /><blockquote
cite="mid200306170730.44746.jgardner@jonathangardner.net"type="cite"><pre wrap="">-----BEGIN PGP SIGNED MESSAGE-----
 
Hash: SHA1

On Tuesday 17 June 2003 02:00, cristi wrote: </pre><blockquote type="cite"><pre wrap="">I want to insert a picture in a
tablefrom an internet browser using a
 
script made in perl.
Has somebody a code example with this kind a problem (I need only a code
fragment)?
   </pre></blockquote><pre wrap="">
Despite PostgreSQL's powerful BLOB features, I would strongly suggest against 
storing these kind of things in the database. It is better to have it in a 
local file for several reasons.

1) Apache can server up local images lightning fast
2) You can edit local images with your favorite image editor (ie, Gimp, 
Photoshop)
3) You can ftp, scp, sftp the image around without a problem.
4) You can tar it up and archive it.
5) You can move it off of your burdened PostgreSQL database server machine and 
on to its own image server when your site becomes popular.

While all of the above are certainly possible with PostgreSQL, it is a bit 
more complicated.

And remember, while your database server is small now, it will grow, and grow, 
and grow, and grow. It will one day become the bottleneck in your operations. 
That is an inevitable fact of any dynamic website.

- -- 
Jonathan Gardner <a class="moz-txt-link-rfc2396E"
href="mailto:jgardner@jonathangardner.net"><jgardner@jonathangardner.net></a>
(was <a class="moz-txt-link-abbreviated" href="mailto:jgardn@alumni.washington.edu">jgardn@alumni.washington.edu</a>)
Live Free, Use Linux!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+7yYTWgwF3QvpWNwRAv3WAKDFrjfQUpQFmZFvVMismUeoxABoDQCfY/F7
LajclhvacQOgsn+6qnLEEwQ=
=k0vW
-----END PGP SIGNATURE-----

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend
 </pre></blockquote><br />

В списке pgsql-sql по дате отправления:

Предыдущее
От: Jonathan Gardner
Дата:
Сообщение: Re: [ADMIN] Notification
Следующее
От: Michael A Nachbaur
Дата:
Сообщение: Re: Blobs with perl