Errors on line 638 of Dynamic Charts

Errors on line 638 of Dynamic Charts

Warning: imagepng() [function.imagepng]: gd-png: fatal libpng error: zlib error in...
divider

Warning: imagepng() [function.imagepng]: gd-png: fatal libpng error: zlib error in
/home/account/public_html/includes/MXCharts/mx_charts.inc.php on line 638

Warning: imagepng() [function.imagepng]: gd-png error: setjmp returns error condition in
/home/account/public_html/includes/MXCharts/mx_charts.inc.php on line 638

This error is occurs with php 5.x

Here is a short explaination of the cause:

Since PHP v5.1 the GD function imagepng() accepts compression argument. The compression argument must be from 0 to 9. 4. Images is using the compression settings when creating thumbnails or image resizing for jpeg images which can be from 0 to 100. Because of that using imagepng() function will return fatal error

A fix for this is to change line 638 in the mx_charts.inc.php from

imagepng($image, $this->getRelativePath().$this->getFolder().$this->getFileName(), 90);

to

imagepng($image, $this->getRelativePath().$this->getFolder().$this->getFileName(), 9);
Written by:  - 10 Oct, 2009