dogshasha Posted October 7, 2008 Share Posted October 7, 2008 Greetings to all, <?php $arrayFromDataBase=createArrayFromDataBase("$myQuote"); //Use $myQuote to retrieve all data from database into an array called $arrayFromDataBase displayChartFromArray($arrayFromDataBase); // Display a chart from $arrayFromDataBase generated above ?> Above code snippet is the way I like it to work. But it doesn't. I think it's because in order to display an image, a header like this header("Content-Type: image/png"); has to be sent to the browser. But the page itself already has a header, most likely <meta http-equiv="Content-Type" content="text/html; /> --------------------------------------------------------------- So here is what I had to do to make it work: <?php $arrayFromDataBase=createArrayFromDataBase("$myQuote"); //Use $myQuote to retrieve all data from database into an array called $arrayFromDataBase for chart display and other purposes echo "<img src='displayChartFromDataBase.php?myQuote=$myQuote' />"; ?> The code above works well (NOTE that I pass the variable $myQuote as parameter to another script displayChartFromDataBase.php). The only problem is I have to retrieve the same data twice (one for building up the array $arrayFromDataBase and another for displaying chart) Is there any way to display images in a html/text page? Any suggestions would be appreciated, Alex Link to comment https://forums.phpfreaks.com/topic/127432-displaying-image-inside-a-page/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.