Perl-CGI Image is displayed in browser as binary -


i programming little plugin, generates image via perl gd , displays in browser. far works correct, except image displayed in binary character stream. it's rather annoying google kind of problem, because read temporarily saving file hard disk, love avoid.

this code have far:

$image = $print->png; ## image created correctly, able  #view if saved on local drive  $cgi = new cgi;  print $cgi -> header(),   $cgi -> start_html(),   $cgi -> h1('bernd'),   $cgi -> header(-type=>'image/png');   binmode stdout;   print $image; print $cgi -> end_html(); 

to have call special method of cgi module? because did not find 1 little bit confused.

any appreciated. in advance!

when it's png, image must separate resource/url, pointed html img element or similar, not flow text embedded document. these basics of html, web programming book if not familiar that.

either change image format inline svg, or rewrite program creates img element, , program creating image http response.

it possible combine original program (html response) 1 creating image response, don't recommend newcomers.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -