Scott R. Godin wrote:
JupiterHost.Net wrote:
$image->string($font,2,10,'hello world',$fontcolor); my $png = $image->png or die $!;
err, you mean
or die "$!" not or die $!;
Why? Its redundant and ugly to double quote a string that is a single variable.
the quotes are there to prompt you to include a sensible error message there, in addition to the error, if you like. :P
In this case there is no other sensible error message so why is die "$!"; what I mean when I mean die $!; ? Why no t die "Sensible error message $!"; ?
I wanted to sure I made this point because someone refered to it as the reason $image->png; didn't work, because I'd done it wrong (if I read it right) and that is just not true or else it wouldn't have died witht the no such file error and would have had a syntax error instead.
So I wanted to avoid confusing anyone reading this thread later that has the same problem :)
As for the content type header, it may display in your browser but you should put a content type header so others browsers wonn't have to guess and there fore it will work for everyone :)
I wasn't embedding it in a webpage like so:
<img src="http://localhost/blah/cgi-bin/hello.cgi">
I was literally calling it from the browser's URL line as a file, directly, in which case the content-type header was interfering with the browser's ability to display the image (which would have been obvious had you tried it, as I suggested.)
You're still better off with a content type header for the same reasons I stated before even if you simply put:
http://localhost/blah/cgi-bin/hello.cgi
in your browser's address bar instead of having it in an img tag.
Which you'd find without it it may work in some browsers but not all so you'd have some confused/angry user's. (which would have been obvious had you tried it ;p)
But this is way OT now since its not a matter of getting a browser to display it, its a matter of getting $image->png; to out put anything :)
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>