On Wed, Jan 30, 2013 at 01:54:35PM -0800, Stuart Zurcher wrote:
> I would like to pass raw image data in TurboGears2 to the mako template to
> use in an img tag
> (ie., scr=data:image/jpg,base64,${imagedata}).
I do that, in the mako template
<img src="data:image/png;base64,${w.img_data}" height="${w.img_height}"
width="${w.img_width}" />
and in the widget code that the controller calls:
self.img_data = b64encode(graphv['image'])
self.img_width = graphv['image_width']
self.img_height = graphv['image_height']
Hmm, I have jpg; you have jpg,
is that the problem?
Wikipedia and some stack overflow entries say its jpg;
https://en.wikipedia.org/wiki/Data_URI_scheme#Format
data:[<MIME-type>][;charset=<encoding>][;base64],<data>
- Craig
--
Craig Small VK2XLZ http://enc.com.au/ csmall at : enc.com.au
Debian GNU/Linux http://www.debian.org/ csmall at : debian.org
GPG fingerprint: 5D2F B320 B825 D939 04D2 0519 3938 F96B DF50 FEA5
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.