Hi there, first post with a question. Hope it's not too silly.
I've got a nice frame consisting of a table within a table, links to the left and whatever link is clicked on that php page is included on the right.
This has been working fine so far for a lot of things however I'm using a few pages to gather information via forms from a user which then go and query a db and generate a graph of the users' choice. This graph is a png file.
Now my problem is that i can only make a link to the png file and view solely the graph and nothing else however if i try and include the page which generates and displays the png file all i get is the code which one would get if they tried to open a png file using notepad in the middle of my table.
How do I get the image in the table and not the code "‰PNG ... etc"? Is it because I'm using include?
including generated png graph
Moderator: General Moderators
image
If you generate a PNG can you not just show it like you would a normal image.
http://www.w3schools.com/tags/tag_img.asp
Code: Select all
<img src="graph.png" alt="Graph" />that would be great, if i could but my code looks something like this, I've truncated it for simplicity
Now if i create it so my browser goes to this page it's fine. But all i can see is the image and nothing else.
If I want it so my image is embedded in my webpage all i get is that nasty text i mentioned earlier.
Code: Select all
$im = imagecreatetruecolor($width,$height );
//then lots of stuff to generate the graph
//part to display the graph
Header('Content-type: image/png');
Imagepng ($im);
echo $im;If I want it so my image is embedded in my webpage all i get is that nasty text i mentioned earlier.
Ok i've never worked with these image things. But based on what i have just read on the php website could you save the image as a file and reference that.
imagecreatetruecolor
imagepng
Don't know if that will help
imagecreatetruecolor
imagepng
Code: Select all
$im = imagecreatetruecolor($width,$height );
//then lots of stuff to generate the graph
//part to display the graph
Imagepng ($im,'TempGraph.png');
echo "<img src='TempGraph.png' alt='Graph' />";