Hi. Could anyone shed some light on why this code works ok on some server, but on others it shows a blank image? (i.e everything *but* the text)
Its got me baffled
TIA
Cheers
Andy
Its got me baffled
TIA
Code:
# this is the routine we will run when creating
# an Image::Magick image...
sub gen_Magick {
# grab stuff we need...
my ($string,$date) = @_;
# now we have our 'random' string, and date stuff, lets create the image...
use Image::Magick;
my $image = Image::Magick->new();
print $image->Set( size => "110x50");
print $image->ReadImage('xc:white');
print $image->Colorize( fill => $BackgroundColor );
print $image->Border( width => 5, height => 5, fill => $BorderColor );
# only do these things if the user has decided to...
if ($DoRaise) {
print $image->Raise( width => 5, height => 5, raise => 'True' );
}
# only do these things if the user has decided to...
if ($DoWave) {
print $image->Wave( amplitude => 5, wavelength => 30 );
}
# decide a random font to use...
my @fonts = ('Charter','Arial');
my @number= (0..2);
my $rand = int(rand scalar(@number));
my $font = $fonts[$rand]; #"Charter";
# annotate the image, so we have our string they need to enter...
$image->Annotate(
text => $string,
fill => $TextColor,
x => 15,
y => 30,
pointsize=> 15,
font => $font);
# setup some paths/urls etc...
my $path = $CFG->{build_root_path} . "/AddImages/" . $date . ".gif";
my $url = $CFG->{build_root_url};
print $image->Write($path);
undef $image;
# pass stuff back into our templates....
$IN->param( SessionDate => $date );
$IN->param( ImageURL => "$url/AddImages/$date.gif" );
}
1;
Cheers
Andy