Re: phplot: multiple graphs on one page (table layout)

From: Johnny Geling (jg_at_somespam.is.nothing)
Date: 08/05/04


Date: Thu, 05 Aug 2004 15:27:21 +0200

Erwin Moller wrote:

> Johnny Geling wrote:
>
> <snip>
>
>>How should I do this?
>>
>>Johnny
>
>
> Hi Johnny,
>
>
> The problem you face is that you have a bunch a structured data that you
> need to feed to an imagecreation-script, right?
> And you do not have the data at hand because it is an other script than the
> one producing the <img ..> tag.
>
> This is how I approached that problem last week (and it worked.)
>
> 1) On the page that contains the image(s) put that structured data in the
> session with some clear ID.
>
> $_SESSION["graphsdata"]["graph1234"] = $YourStructuredData;
>
> $YourStructuredData is an array that contains it all.
>
> 2) Make an imagetag with the right identifier:
> <img src="yourimagescript.php?graphid=<?= $theID ?>">
>
> where $theID is 1234
>
> 3) In your imagecreatescript:
> $graphid = $_GET["graphid"];
> $myStructuredData = $_SESSION["graphsdata"]["graph".$graphid];
>
> now you have 'imported' the data in $myStructuredData
>
> Be sure to unset it in the session when you are done!
> It is unneeded big for your session.
>
> Alternatively you could serialize the original data and url-encode it, and
> paste it behing the ? in the imagetag.
> But in my case the data could be so huge that i didn't want it to be passed
> to the client and back.
>
> Hope that helps you.
>
> Good luck,
> Erwin Moller (also Dutch)
>
>
The data is already in an object and availible as session variable.
But I had problems to pass through the data to the image script. Have to
think it over and your suggestion sure helps.

Johnny



Relevant Pages