Statistics3 package - corrupted PNG images

Hi everyone,

I’ve noticed quite a few messages on the lists regarding corrupted
graphs’ images genereated by Haralad Wagener’s Statistics3 package. I
too was faced with the same problem, particularly new-line being added
in the begining of image output resulting in broken PNG image header.
While I didn’t find any practicle resolution to this issue in the list
archive I was nevertheless able to solve the problem a few ways. Here is
what I did:

  1. I figured out that when printing to a file images are generated
    properly. So explicitly specified the STDOUT descriptor in print
    statement and that resulted in proper image being generated. So for
    example in “Statistics/Resolution/Elements/Chart” print satement looks like:

<%perl>
print STDOUT $graph->plot(@data)->$format();
—SNIP—

  1. Reading up on HTML::Mason I found out that Mason buffers all its
    output but gives you a way to clear the buffer. Next thing I tried is to
    revert to original print statement without explicitly naming STDOUT
    descriptor but clearing the output buffer beforehand. This also has
    worked and generated proper images not prepended by a newline.

<%perl>
$m->clear_buffer();
print $graph->plot(@data)->$format();
—SNIP—

  1. HTML::Mason has a preferred output method $m->out(), replacing print
    statement with $m->out has also worked, but $m->clear_buffer() was still
    necessary to avoid newline injection.

<%perl>
$m->clear_buffer();
$m->out($graph->plot(@data)->$format());
—SNIP—

Hope this is helpful to some of you having similar issues.

–Alex

Alex,
The “extra newline” seems to have been caused by a semi-recent
change to RTFM. Jesse released a newer version to fix this a couple of
weeks ago (sorry don’t remember the date or RTFM version, you could
check the archives), and that seemed to correct it. It didn’t work for
me until I realized that I had some tweaked RTFM files in my local area
(since those override the ones in the share area where RTFM is installed
by default). Once I removed the local versions, the problem went away.

Kelly F. Hickel
Senior Software Architect
MQSoftware, Inc
952.345.8677
kfh@mqsoftware.com

-----Original Message-----
From: Alex Rebrik [mailto:arebrik@zappos.com]
Sent: Friday, January 30, 2004 4:19 PM
To: rt-devel@lists.bestpractical.com
Subject: [rt-devel] Statistics3 package - corrupted PNG images

Hi everyone,

I’ve noticed quite a few messages on the lists regarding corrupted
graphs’ images genereated by Haralad Wagener’s Statistics3 package. I
too was faced with the same problem, particularly new-line being added
in the begining of image output resulting in broken PNG image header.
While I didn’t find any practicle resolution to this issue in the list
archive I was nevertheless able to solve the problem a few ways. Here
is
what I did:

  1. I figured out that when printing to a file images are generated
    properly. So explicitly specified the STDOUT descriptor in print
    statement and that resulted in proper image being generated. So for
    example in “Statistics/Resolution/Elements/Chart” print satement looks
    like:

<%perl>
print STDOUT $graph->plot(@data)->$format();
—SNIP—

  1. Reading up on HTML::Mason I found out that Mason buffers all its
    output but gives you a way to clear the buffer. Next thing I tried is
    to
    revert to original print statement without explicitly naming STDOUT
    descriptor but clearing the output buffer beforehand. This also has
    worked and generated proper images not prepended by a newline.

<%perl>
$m->clear_buffer();
print $graph->plot(@data)->$format();
—SNIP—

  1. HTML::Mason has a preferred output method $m->out(), replacing
    print
    statement with $m->out has also worked, but $m->clear_buffer() was
    still

Found Jesse’s note. The release with the fix in it was RTFM 2.0.3.RC1,
and his email to rt-users was dated 1/8/2004 at 6:09pm.

Kelly F. Hickel
Senior Software Architect
MQSoftware, Inc
952.345.8677
kfh@mqsoftware.com

-----Original Message-----
From: Kelly F. Hickel
Sent: Friday, January 30, 2004 4:22 PM
To: Alex Rebrik; rt-devel@lists.bestpractical.com
Subject: RE: [rt-devel] Statistics3 package - corrupted PNG images

Alex,
The “extra newline” seems to have been caused by a semi-recent
change to RTFM. Jesse released a newer version to fix this a couple
of
weeks ago (sorry don’t remember the date or RTFM version, you could
check the archives), and that seemed to correct it. It didn’t work
for
me until I realized that I had some tweaked RTFM files in my local
area
(since those override the ones in the share area where RTFM is
installed
by default). Once I removed the local versions, the problem went
away.

Kelly F. Hickel
Senior Software Architect
MQSoftware, Inc
952.345.8677
kfh@mqsoftware.com

-----Original Message-----
From: Alex Rebrik [mailto:arebrik@zappos.com]
Sent: Friday, January 30, 2004 4:19 PM
To: rt-devel@lists.bestpractical.com
Subject: [rt-devel] Statistics3 package - corrupted PNG images

Hi everyone,

I’ve noticed quite a few messages on the lists regarding corrupted
graphs’ images genereated by Haralad Wagener’s Statistics3 package.
I

too was faced with the same problem, particularly new-line being
added

in the begining of image output resulting in broken PNG image
header.

While I didn’t find any practicle resolution to this issue in the
list

archive I was nevertheless able to solve the problem a few ways.
Here
is

what I did:

  1. I figured out that when printing to a file images are generated
    properly. So explicitly specified the STDOUT descriptor in print
    statement and that resulted in proper image being generated. So for
    example in “Statistics/Resolution/Elements/Chart” print satement
    looks

like:

<%perl>
print STDOUT $graph->plot(@data)->$format();
—SNIP—

  1. Reading up on HTML::Mason I found out that Mason buffers all its
    output but gives you a way to clear the buffer. Next thing I tried
    is

Great - thanks I’ll try that when I move our RT to a new server this
weekend. I was running (still am) RTFM 2.0.1.

–Alex

Kelly F. Hickel wrote:

Cool. FYI, Jesse just (10 minutes ago) released 2.0.3rc5, so I’d
recommend that one instead of rc1.

Kelly F. Hickel
Senior Software Architect
MQSoftware, Inc
952.345.8677
kfh@mqsoftware.com

-----Original Message-----
From: Alex Rebrik [mailto:arebrik@zappos.com]
Sent: Friday, January 30, 2004 4:44 PM
To: Kelly F. Hickel
Cc: rt-devel@lists.bestpractical.com
Subject: Re: [rt-devel] Statistics3 package - corrupted PNG images

Great - thanks I’ll try that when I move our RT to a new server this
weekend. I was running (still am) RTFM 2.0.1.

–Alex

Kelly F. Hickel wrote:

Found Jesse’s note. The release with the fix in it was RTFM
2.0.3.RC1,