Subject: | Possible bug in GD |
This is a simple problem I seem to have run across and I am uncertain
whether it is a GD.pm problem or a problem elsewhere. If elsewhere
(most likely in the underlying code that GD.pm calls) - please let me
know. Thanks.
Problem: If the path string is long, GD can not find the file.
Example:
GD does not find: "c:/apache/frp/Images/Patterns/Bricks_CUD.gif"
GD does not: "c:/apache/frp/Images/Bricks_CUD.gif"
GD finds: "c:/apache/frp/Bricks_CUD.gif"
GD finds: "./Bricks_CUD.gif"
Notes:
I thought that maybe, because the name was longer than the 8.3 filename,
that that might be GD's problem. But as stated above, it will find the
file if it is in the same directory as the program. So next I thought
that the "_CUD" might be causing problems - but again - it finds the
file if it is in the same directory as the program.
So my only guess left is that it is the length of the directory path
that is causing the problem. (I just did multiple tests and that is why
there are four examples now.)
Code:
sub test
{
use GD;
my $img = new GD::Image( 100, 100, 1 );
my $myFile = GD::Image->newFromGif(
"c:/apache/frp/Images/Patterns/Bricks_CUD.gif" );
my ($myWidth, $myHeight) = $myFile->getBounds();
my $myBrush = new GD::Image( 72, 72, 1 );
my $rgb_r = (128 << 16);
my $poly = new GD::Polygon;
#
# Polygon to be tiled.
#
$poly->addPt( 25, 0 );
$poly->addPt( 25, 75 );
$poly->addPt( 35, 65 );
$poly->addPt( 35, 0 );
#
# Move the loaded in GIF file to a truecolor image
# and then use it as a tile.
#
$myBrush->copy( $myFile, 0, 0, 0, 0, 72, 72 );
$img->setTile( $myBrush );
$img->filledRectangle( 0, 0, 100, 100, $rgb_r );
$img->filledPolygon( $poly, gdTiled );
}
If the image is loaded it displays a brick pattern. If it is not loaded
a black area is displayed.
Again, if this is outside of GD.pm's problems, please let me know. Thanks.
As an aside - setTile doesn't allow for transparency does it?
System Info:
GD.pm Version: 2.31
Perl Version: 5.8.7 (latest from ActiveState)
OS: Windows XP - SP2 with latest updates
There are no warnings or error messages posted.
Haven't yet found the location of the error yet. If I find it - I will
post where the error is located so it can be fixed. So this is more of
a heads-up kind of thing or if it is a known issue or would be in
another location - let me know that. Thanks.