Community Add-Ons

Maintainers: sylvioruiz
Add file to this package
Top » Reports

Fix Graph Titles
for osCommerce Online Merchant v2.3

The PHPlot Class is very old (2003) and it does not support utf8 chars by default.

You can fix strange characters in the Graph Title changing a singe line on the file source.

1) Open the /admin/includes/classes/phplot.php
2) Go to line : 609
3) Replace "$this->title_txt = $title;" by "$this->title_txt = utf8_decode($title);"

Done.

Legend:  Download   Report

Expand All / Collapse All

Understanding the PHPlot Class sylvioruiz 8 Oct 2015  

My first solution works fine if translations files can be translated to ISO-8859-1 (this is my case).

The PHPlot uses imagestring, imagestringup, from the GD library to render text on the image, and it must to be translated to use imageTTFtext instead.

imagestring-function doesn't properly show UTF-8 characters.

As workaround is use the imagettftext-function.

When using imageTTFtext instead of imagestring, you have to know, that you don't use the $font-ids from PHP, instead you use fontfiles.

So: imagestring ( resource $im, int $font, int $x, int $y, string $s, int $color )
Becomes to: imagettftext ( resource $im, int $size, int $angle, int $x, int $y, int $color, string $fontfile, string $text )

I will try to fix the Class to use UTF-8 by default replacing those functions on the next days, but you still needing to upload a font file with all characters for your translation files, if the mine does not support them (like japanese, chinese, etc).

Fix Graph Titles sylvioruiz 8 Oct 2015