Thomas G. Apostolou wrote:
Hello all,
i am a niewbie using-learning -Python-Zope-Plone and i am trying to
retrive-show some data from Sql Server 2000.
Among those data there is a BLOB image field.
Trying to find out how to show this field as image i was reading another
older thread titled "How to have a servlet return an image?" dated
05/20/2004.
(...)
My problems and questions are:
1) I cannot get to find where cms module is to import ImageComponent
2) What exactly is the id i sould pass and where is the table that contains
the BLOB image field passed?
the "id=666" suggests me i'm the author of the reply you quoted above :)
only God knowns what exatcly is ImageComponent, I cannot recall now,
but that:
row = db.row(cm.connection, ImageComponent._table, ImageComponent._pk,
int(id))
can be essentially translated in dbapi2 speak as:
cursor = connection.cursor()
cursor.execute("select * from images where id = %s", (id,))
row = cursor.fetchone()
# use returned row
# row['data'] etc.
hence, forget the ImageComponent thing, it's just a thin wrapper
around the tables on the DB.
to store an image in the DB you basically need a table with a
primary key (id), a blob field (data) and two convienice fields
"size" and "mime_type".
-- deelan.
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss