String Literal to Blob
Steve Holden
steve at holdenweb.com
Thu Apr 10 19:06:46 EDT 2008
Victor Subervi wrote:
> Well, what I did was this:
>
> content = col_fields[0][14].tostring()
> pic = "tmp" + str(i) + ".jpg"
> img = open(pic, "w")
> img.write(content)
> print '<img src="%s"><br /><br />' % pic
> img.close()
> where I am incrementing i. Ugly. Stupid. But if it is the only way to do
> it in python, and I do not want to invest the time doing it in php,
> which I think would be prettier in this instance, then I guess it will
> do. Your thoughts appreciated.
> Victor
>
It is not the only way to do it on Python, it's not even an especially
good way. But I suggest you either read what I have already written more
carefully, or study HTTP and HTML until you understand what you are
doing unnecessarily wrong. There is absolutely no need to save the
images to the file store (otherwise there would be no point in having
them in the database in the first place). You simply need to understand
how to serve them dynamically.
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
More information about the Python-list
mailing list