String Literal to Blob

Victor Subervi victorsubervi at gmail.com
Mon Apr 14 09:29:57 EDT 2008


Thanks to all, especially Gabriel. The base64 is a good idea, but you state
a definite problem. I will look at your code at home (offline)...thank you
very much! It looks like the kicker is this line here:

<img src='getpic.py?id=%d' alt='%s'>" % (picid, cgi.escape(title))

Now, why didn´t you share that before????? I can see how calling a separate
script like that would work! Again, you should have shared that before. How
was I to think of that clever trick from the bare information you gave me
earlier??

Steve, thank you for all your help, but do overcome your temper :))
Victor

On Sun, Apr 13, 2008 at 7:05 AM, Steve Holden <steve at holdenweb.com> wrote:

> Jason Scheirer wrote:
> [...]
> >
> > There _is_ a way to embed image data in HTML that is supported by
> > every major browser. It is ugly. Using the RFC 2397 (http://
> > www.ietf.org/rfc/rfc2397) spec for data URLs you could go
> >
> > '<img src="data:image/jpg;base64,%s">' % base64.b64encode(image_data)
> >
> > Obviously you need to import the base64 module somewhere in your code
> > and base64-encoded data is about a third larger than it would be
> > otherwise, so embedding anything particularly large is going to be a
> > huge pain and affect page load times pretty badly.
>
> This is hardly likely to help someone who hasn't yet grasped the concept
> of referencing graphics and prefers to write database output to disk to
> serve it statically. But who knows, maybe it will ...
>
> regards
>  Steve
> --
> Steve Holden        +1 571 484 6266   +1 800 494 3119
> Holden Web LLC              http://www.holdenweb.com/
>
>  --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080414/7b9a0c92/attachment.html>


More information about the Python-list mailing list