Jump to content
Server Maintenance This Week. ×

PHPlot & SmartPill Problems


This topic is 6304 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I'm trying to use PHPlot from SourceForge ( http://sourceforge.net/projects/phplot ) and I try to create a simple plot with this code:


require_once 'phplot/phplot.php';



$plot =& new PHPlot();



// Uncomment this line to send output to top level of your hard disk (at least on MacOS X)

//$plot->SetOutputFile('mygraph.png');



$plot->SetIsInline(true);

$data = array(array('', 0, 0), array('', 1, 9));

$plot->SetDataValues($data);

$plot->SetDataType('data-data');

$plot->DrawGraph();

When executed, the output from SmartPill is only 8 bytes long - basically the first 8 bytes of the PNG image that should be outputted. If I uncomment the call to SetOutputFile the graph is written to the mygraph.png file perfectly. So, is this a bug in SmartPill or am I missing something obvious?

Also, calls to Header() don't work with SmartPill - is this a known limitation?

Link to comment
Share on other sites

It sounds like you're trying to set the contents of a container field? If so, this isn't supported, instead you have to write the file to disk and then import it. You can then delete it if you like or we sometimes just use a name like temp and overwrite it each time. We're looking into adding support for writing to containers in the next version.

In regards to the header() function, what are you trying to achieve?

Link to comment
Share on other sites

Boiling it all down, PHPlot generates a PNG/JPG/GIF image of a chart, and yes, my ultimate desire was to put the resulting image into a FileMaker container field. So I guess what you're saying is the call to ImagePng(), ImageJPEG(), ImageGIF(), and others just don't work if you try to send the output to PHP's default output device?

As I discovered that you can write to a file OK and as you suggested, that's the work around I'll use. Not a big deal.

Sorry for my confusion here - I was just assuming that basically 'any' PHP code was going to work. Is there a list of what is (or isn't) supported or at least areas of PHP functionality we should stay clear of?

I asked about Header() because PHPlot was using them, and I noticed that not even that data was being outputted. I'll grant you that not having Header() work isn't a big deal, but it goes back to my question above about knowing what is/isn't supported with SmartPill.

Please don't get me wrong - I think SmartPill is a great tool and I look forward to using it 'for real'.

Link to comment
Share on other sites

> Boiling it all down, PHPlot generates a PNG/JPG/GIF image of a chart, and

> yes, my ultimate desire was to put the resulting image into a FileMaker

> container field. So I guess what you're saying is the call to ImagePng(),

> ImageJPEG(), ImageGIF(), and others just don't work if you try to send the

> output to PHP's default output device?

We need to provide a special function in order to write to a container field. The issue has to do with FileMaker's plug-in API which requires special handling when dealing with container fields.

> As I discovered that you can write to a file OK and as you suggested, that's

> the work around I'll use. Not a big deal.

>

> Sorry for my confusion here - I was just assuming that basically 'any' PHP

> code was going to work. Is there a list of what is (or isn't) supported or

> at least areas of PHP functionality we should stay clear of?

You always have to check for extension support, although we support quite a few; use print_r(get_loaded_extensions()); to see the list. I don't know if you've used the PHP CLI (command line interface) but using SmartPill is very similar. You can visit http://us3.php.net/features.commandline for more info or do a search on "PHP CLI".

We haven't compiled a list of functions that aren't supported.

> I asked about Header() because PHPlot was using them, and I noticed that not

> even that data was being outputted. I'll grant you that not having Header()

> work isn't a big deal, but it goes back to my question above about knowing

> what is/isn't supported with SmartPill.

>

> Please don't get me wrong - I think SmartPill is a great tool and I look

> forward to using it 'for real'.

No problem, I'm happy to answer any questions...

Link to comment
Share on other sites

This topic is 6304 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.