Inline images

View: New views
3 Messages — Rating Filter:   Alert me  

Inline images

by Milos Negovanovic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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?

Regards
--
Milos Negovanovic
milos.negovanovic@...

------------------------------------------------------------------------------
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
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

Re: Inline images

by James Abbatiello :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, Sep 13, 2009 at 5:52 AM, Milos Negovanovic
<milos.negovanovic@...> 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

--
James Abbatiello

------------------------------------------------------------------------------
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
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

Re: Inline images

by Milos Negovanovic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, Sep 13, 2009 at 09:49:24AM -0400, James Abbatiello wrote:

> On Sun, Sep 13, 2009 at 5:52 AM, Milos Negovanovic
> <milos.negovanovic@...> 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
milos.negovanovic@...

------------------------------------------------------------------------------
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
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss