Loading ...
Sorry, an error occurred while loading the content.
 

[Cheetahtemplate-discuss] Inline images

Expand Messages
  • Milos Negovanovic
    Hi all, I have fallowing simple template: where $pic is the contents of the PNG file read from disk. Error I am
    Message 1 of 3 , Sep 13, 2009
      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
    • James Abbatiello
      On Sun, Sep 13, 2009 at 5:52 AM, Milos Negovanovic ... I m not sure but if you are claiming the data is base64, don t you have to base64 encode it?
      Message 2 of 3 , Sep 13, 2009
        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
      • Milos Negovanovic
        ... Yes that helped, many thanks. base64 encoding the image source before passing to cheetah works. Regards -- Milos Negovanovic
        Message 3 of 3 , Sep 13, 2009
          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
        Your message has been successfully submitted and would be delivered to recipients shortly.