String Literal to Blob
Steve Holden
steve at holdenweb.com
Fri Apr 11 15:05:13 EDT 2008
Victor Subervi wrote:
> I have worked on this many hours a day for two weeks. If there is an
> easier way to do it, just take a minute or two and point it out. Have
> you heard of the Law of Diminishing Returns? I have passed it long ago.
> I no longer want to waste time trying to guess at what you are trying to
> tell me.
> Victor
>
> On Fri, Apr 11, 2008 at 8:55 AM, Steve Holden <steve at holdenweb.com
> <mailto:steve at holdenweb.com>> wrote:
>
> Victor Subervi wrote:
> > Nope. Do not see it. My ugly stupid way works. I guess I will just
> > proceed with that and write my howto accordingly.
> > Victor
> >
> OK, but be prepared for some pretty scathing feedback. You will make it
> clear you do not understand the web. I'd suggest a little more reading
> first.
>
You aren't the only one whose patience and endurance is being tried by
this thread.
Take a look, for the want of anything better, at
http://holdenweb.com/
View the source of that page, and the first image you will find inside
it reads
<img src="/images/homepage/hd_explore.png" alt="" height="24"
width="142" border="0">
Then direct your browser to
http://holdenweb.com/images/homepage/hd_explore.png
and you will see just the image. After the change I detail below, you
will have turned your script into the dynamic equivalent of the static
image I directed you to above.
Where you have
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()
instead write
print content
Then browse to the URL this program serves and you will see the image
(assuming you are still sending the image/jpeg content type). Once you
can see the image, THEN you can write a page that refers to it. Until
you start serving the image (NOT pseudo-html with image data embedded in
it) nothing else will work.
Then you can start writing <img ...> tags that include your (dyanmic)
URLs and have your script serve the images retrieved from the database.
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