Windows
(8.9 MB Zip)
Linux (32 Bit)
(10 MB Tar.gz)
Linux (64 Bit)
(10 MB Tar.gz)
Current version:
0.1.3
FCImg is a third party tool to allow servers running the LAMP stack to export FusionCharts Charts as images without a need for a browser. It is free of charge, but you still need a FusionCharts license to use it. The download includes a copy of the FusionCharts evaluation version, but you can easily replace it with your licensed copy as described here.
Download the appropriate package for your platform and extract it in a path that your PHP Scripts can read. Currently, only PHP 5.2 or above is supported. Shared hosts are supported as long as safe_mode is not emabled. (Enabling safe_mode is not recommended and most hosts turn this off)
First, require fcimg.php from your PHP script. Now call the fusioncharts_to_image function, with the following arguments in this order:
outputFilePath: The full path to the output image. If this file already exists, it will be overwritten.swfName: The FusionCharts SWF filename which will be used to determine which type of chart to render.inputString: The Data String in XML or JSON format. Note that the converter will automatically determine whether the input is XML or JSON.height: The height of the chart in pixelswidth: The width of the chart in pixelsoptions: This is an array to configure optional parameters. This is treated as a key-value set.
$options["imageType"]: Specifies the type of the image (png/jpg). Default: png.$options["quality"]: The Image quality (0-100). Note that a higher quality might take longer to render. Default: 70.
require "fcimg/fcimg.php";
fusioncharts_to_image (
"/var/www/report.png", // path to image
"Column3D.swf", // SWF Name. SWF File not required
$inputString, // the input XML String
400, 500, // height and width
array( // options
'imageType' => 'jpg', // set image type as JPG
'quality' => 75 // increase Quality
)
);
The conversion engine waits 1 second before capturing the state of the chart. In the event that the animation hasn't completed, the result of the chart might not be appropriate. By disabling animation, you can ensure that the exporter provides optimum results.
The conversion process takes upto 2-3 seconds on an average server. The call to fusioncharts_to_image blocks the thread. Thus it is highly not recommended to use this function inside a script that serves web pages.
Instead, this is ideal for background scripts that generates reports, where there won't be concurrent calls to the exporter, and situations where the render time won't introduce latency
For Linux/OSX based servers, the contents of "fcimg/bin" needs to be executable. While this should be enabled by default (GNU tar will preserve file attributes), you can manually set them executable by using the command chmod +x fcimg/bin/*.
The current process to use a Licensed copy of FusionCharts isn't automated. There will be a Windows BAT script and a Linux BASH script provided in the next release. However, there is an alternative method:
FCImg is a project developed in my spare time, and is released with the hope that people find it useful. If you find some bug or feature request, please email it to me at contact@fcimg.org. It will help if you include details like the XML/JSON data.
Windows: de1c7f493caf0ff8328c2403ca01a3c10b6f6f22
Linux (32 Bit): 477c8c3dbd1cfda51f58e3cbc98cc7a0339806d0
Linux (64 Bit): baf8ea193a942bf488018eadcc73ad68d8c9b0bb