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
# 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 (mod)
andy@ultranerds.co.uk
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
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 (mod)
andy@ultranerds.co.uk
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates

