I have a template in angularjs
expecting the image data uri
returned by a server call invoked through the src
attribute of the img
element of the template:
<img width="200px" height="200px" src="http://localhost:3000/returnimage" />
On the server side, written in Perl
with Dancer
I have:
any ['get', 'post'] => '/returnimage' => sub {
content_type 'image/jpeg;base64;';
'data:image/jpeg;base64,/9j/4gIcSUNDX1B....N5f2hqE//Z';
};
The result on template render is a broken image tag: But the call is executed:
The network response and preview are unavailable. But if I call http://localhost:3000/returnimage
directly from the browser they do contain the complete image data uri
as 'data:image/jpeg;base64,/9j/4gIcSUNDX1B....N5f2hqE//Z'. ALthough a black image shows up and when inspected:
Any ideas on problem/fix ?
Perl subroutine: