For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > March 2004 > GD text in existing image









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author GD text in existing image
Daniel van den Oord

2004-03-26, 11:14 pm

I'm trying to put text in an existing image. I got this working with the
following code.
I need this because I am making a FAQ and want certain screenshots with auto
filled in names
I tried putting this lines in a working script though I get carbage on my
screen now.. I think this is a result of a conflict between content-type:
HTML/Text\n\n en binmode ?!?

How can I overcome this ?!?
#!/usr/bin/perl -w

use GD;

$im = newFromPng GD::Image("../../images/frontpage/circle.png");
$black = $im->colorAllocate(0,0,0);
$im->string(gdSmallFont,2,10,"Testing",$black);
binmode STDOUT;
print $im->png;


Joe Smith

2004-03-26, 11:14 pm

Daniel van den Oord wrote:

> carbage... I think this is a result of a conflict between content-type:
> HTML/Text\n\n en binmode ?!?


You're supposed to output "Content-type: image/png\n\n"
before setting STDOUT to binmode.
-Joe
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com