0

Here is what i want to do, but have trouble figuring out:

I have a variable:

${image}

Which contains (%s is replaced with image data there):

'data:image/png;base64,%s'

In mako template, i want to use this variable to provide background image:

<div id="watermark" style="background-image: url('${image}'); background-position: bottom left; background-repeat: no-repeat;"></div>

And this, of course, doesn't work. Is there a way to make it work?

Or even, is it possible and how, to take variable and use it to put a piece of html in template, for xample ${myvar} placement in .mako would provide complete div already containing a style with image data?

Many thanks!

1 Answers1

0

There's no reason that this shouldn't work. Try removing the single quotes around ${image} in the url() section of the css.

If that doesn't do it, you can isolate the problem by hard coding the base64 of a dummy image into your css. If that image renders, you know your problem isn't in your css/html.

sarwar
  • 2,835
  • 1
  • 26
  • 30