Re: Inline images

Milos Negovanovic <[email protected]> Sun, 13 Sep 2009 16:49:13 +0100
Newsgroups gmane.comp.python.cheetah
Message-ID <[email protected]>
On Sun, Sep 13, 2009 at 09:49:24AM -0400, James Abbatiello wrote:
> On Sun, Sep 13, 2009 at 5:52 AM, Milos Negovanovic
> <[email protected]> wrote:
> > Hi all,
> >
> > I have fallowing simple template:
> >
> > <img src="data:image/png;base64,$pic" />
> >
> > where $pic is the contents of the PNG file read from disk. Error I am
> > getting is:
> >
> > ('ascii' codec can't decode byte 0x89 in position 0: ordinal not in range(128))
> >
> > I've tried decoding contents of $pic manually as well but none of the
> > utf-8, utf-16, utf-32 encodings work!
> >
> > Anyone know how to display inline images with cheetah?
> 
> I'm not sure but if you are claiming the data is base64, don't you
> have to base64 encode it?
> http://docs.python.org/library/base64.html#base64.b64encode

Yes that helped, many thanks. base64 encoding the image source before
passing to cheetah works.

Regards
-- 
Milos Negovanovic
[email protected]

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july