String Literal to Blob

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sat Apr 12 22:51:36 EDT 2008


En Sat, 12 Apr 2008 22:14:31 -0300, Jason Scheirer  
<jason.scheirer at gmail.com> escribió:
> On Apr 12, 2:44 pm, Steve Holden <st... at holdenweb.com> wrote:
>> Victor Subervi wrote:

>> > Well, as I mentioned before, I am sending text/html because the page,
>> > like almost all web pages, has a whole lot more content than just
>> > images. Or, perhaps you are suggesting I build my pages in frames, and
>> > have a frame for every image. Unsightly!
>>
>> Dear Victor:
>>
>> If you cannot understand, after being told several times by different
>> people, that pages with images in them are achieved by multiple HTTP
>> requests, then there is little I can do to help you.
>> [...]
>> Please, do yourself a big favor and persist with this until you
>> understand what you are doing wrong and how to serve dynamic images. It
>> appears that the learning may be painful, but I guarantee it will be
>> worthwhile.
>
> 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)

Another alternative would be to generate a multipart/related document, but  
I think the OP will gain a lot more understanding the simple cases than  
using those esoteric features.

-- 
Gabriel Genellina




More information about the Python-list mailing list