Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- GD::Graph::_read_logo_file and export_format
- Mason G. Zhwiti
February 20, 2007, 8:20 pm
rate this thread
I am working with version 1.4308 of GD::Graph and version 2.35 of the
perl GD module on Windows 2003 Server, perl build 5.8.8 (ActivePerl
build 820, specifically).
Previously I was using an older version of GD/GD::Graph on an earlier
version of Perl, and it was working fine.
Now when I am drawing charts, I receive an error at the point in my
code where I GD::Graph is reading in the logo file to display on the
chart. When I added some debugging print statements to GD::Graph, I
discovered the issue is that it (_read_logo_file() in GD::Graph) is
trying to load my logo file using newFromGif, even though the file is
a PNG file. _read_logo_file() determines filetype by calling $self-
possible format(s), not the actual output format of the chart, which
you wouldn't know until the chart is exported as an image (right?). In
addition, I can find no way of telling GD::Graph what format the logo
file is in, or what format I want to export it in, until I export it.
Therefore I think _read_logo_file() needs to determine the image
format in some other way. I modified my copy of GD::Graph so that it
defaults to examining the logo filename itself, and then falls back to
its current method. So rather than:
my $gdimport = 'newFrom' . ucfirst($self->export_format);
my $gdimport = 'newFrom' . ($self-> =~ /\.(\w+)$/) ?
ucfirst($1) : ucfirst($self->export_format);
Now my code works without any errors, although obviously I'd rather it
work using the stock Graph module.
Am I just missing something or is this a bug?