Search Postgresql Archives

Re: Storing images in PostgreSQL databases (again)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/05/06 19:41, Bill Moran wrote:
> "Leonel Nunez" <lnunez@xxxxxxxxxxxxxx> wrote:
>>> If the database had built-in functions to manipulate images (make a
>>> thumbnail, add text ont it.., make a montage of two pictures) and I could
>>> write something like
>>> select thumbnail(image_field, 100, 100) from images_table
>>> that would be a good reason to go the db route versus the filesystem
>>> route.
> 
> <snip>
> 
>> With Python   and  the  python imaging library   you can do  this  :
>>
>> image is a bytea  field
>>
>> curs = conn.cursor ()
>> curs.execute( "select image from images where name = %s" ,(thename, ))
>> row = curs.fetchone()
>> if row:
>>    im = Image.open (StringIO.StringIO(row[0]))
>>    im.thumbnail (160,120 )
>>    imagetmp = StringIO.StringIO()
>>    im.save ( imagetmp  , "JPEG")
>>    print ("Content-type: image/jpeg\n\n")
>>    print ( imagetmp.getvalue())
> 
> I think part of the point, which you missed, is the convenience of having
> the thumbnailing as part of the SQL language by making it a stored
> procedure.

Would untrusted pl/python be able to do this?

> I did a presentation for WPLUG not too long ago where I created C
> functions in Postgres compiled against the GSOAP library that allowed
> you to make simple SOAP calls in SQL within PostgreSQL.  Neat stuff.
> 
> The problem with creating those kinds of functions is the CPU overhead.
> We'll be generating the thumbnails and storing them in a "thumbnail"
> field in the record, so we don't have to regenerate the thumbnail each
> time it's needed.
> 
> BTW: our reason for keeping the thumbnails in fields is so they can be
> replicated with Slony along with the rest of the database.
> 


- --
Ron Johnson, Jr.
Jefferson LA  USA

Is "common sense" really valid?
For example, it is "common sense" to white-power racists that
whites are superior to blacks, and that those with brown skins
are mud people.
However, that "common sense" is obviously wrong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFJbVOS9HxQb37XmcRAoFXAKCy8+MIMuWCAaxeJyvijAVGP/RwhACgzO3T
Q1pruQgrFSvsdiUEwtLvgDk=
=XZD2
-----END PGP SIGNATURE-----


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux