barneyf Posted March 19, 2009 Share Posted March 19, 2009 I have an intranet application where I want to embed database driven XY graphs in a web page. I have a PHP script ("master.php") that generates the HTML output consisting of a mixture of HTML tables and graphs. Currently master.php writes out an IMG tag that uses graph.php as the data source. graph.php generates the PNG image via the GD library. This XY graph will have 1000 points per line and could have 20 or 30 lines so lots of data. This works OK if graph.php pulls the data from the database. But... I don't want to have graph pull the database info, I want master.php to pull the data, massage it, and pass it on to graph.php as a 2D array. This keeps all of my database queries & data massaging in master.php. All graph.php should do is take the array and generate a PNG image for the graph. I am looking for suggestions on how master.php can pass the data on to graph.php and prefer not to use GET (too much data) or a file (too slow). Using SESSION would work, but seems like overkill as I don't need to keep the data once it is passed on to graph.php. Any elegant solutions to this situation? If I could make graph.php an object and have the IMG tag call one of it's methods, that would be elegant. But so far I haven't found a way to make that work. Link to comment https://forums.phpfreaks.com/topic/150077-solved-embedding-graphs-in-web-page/ Share on other sites More sharing options...
barneyf Posted March 23, 2009 Author Share Posted March 23, 2009 After much research, I determined that the only way to display the image is with the HTML <img src="...."> tag. This can either call a separate PHP script, or you can embed a small image (ie icon sized) as a URL embedded image. So I use the $_SESSION global to hold the data while waiting for the user's browser to call the PHP page defined in the <img src="....." > tag. Link to comment https://forums.phpfreaks.com/topic/150077-solved-embedding-graphs-in-web-page/#findComment-792129 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.