thefollower Posted August 19, 2007 Share Posted August 19, 2007 Hey guys, im new here. I have been making a script which creates a graphical image, now i put it in a file then i included that .php file into the page which then displays it... but its not work it just either: not displays.. creates an error or it will display but then not display my html after it :S heres the script: <? //connects and loads session include("include.php"); //Energy Bar for user $MaxEnergy = $row["MaxEnergy"]; $CurrentEnergy = $row["CurrentEnergy"]; $height = 5; $width = 93; $NewCurrentEnergy =($CurrentEnergy / $MaxEnergy) * $width; $im = Imagecreatetruecolor($width, $height); $red = Imagecolorallocate($im, 400, 0, 10); $green = Imagecolorallocate($im, 0, 400, 10); imagefill($im, 0, 0, $red); imagefilledrectangle($im, 0, 0, $NewCurrentEnergy, $height, $green); header("Content-type: image/png"); Imagepng($im); Imagedestroy($im); ?> Then in my html page i put: <? include("include.php"); include("layoutglobal.php"); ?> for testing. I haven't put positions for it yet using html cos i needed to get it working at the very least. But it wont show the html after those 2 includes. Quote Link to comment https://forums.phpfreaks.com/topic/65712-overwrites-my-html-s/ Share on other sites More sharing options...
plutomed Posted August 19, 2007 Share Posted August 19, 2007 This is just a guess, could it be something to do with: header("Content-type: image/png"); Quote Link to comment https://forums.phpfreaks.com/topic/65712-overwrites-my-html-s/#findComment-328225 Share on other sites More sharing options...
thefollower Posted August 19, 2007 Author Share Posted August 19, 2007 well, im unfamiliar on were that should go.. Quote Link to comment https://forums.phpfreaks.com/topic/65712-overwrites-my-html-s/#findComment-328226 Share on other sites More sharing options...
LiamProductions Posted August 19, 2007 Share Posted August 19, 2007 Then in my html page i put: <? include("include.php"); include("layoutglobal.php"); ?> You can't put PHP code in a html file. Quote Link to comment https://forums.phpfreaks.com/topic/65712-overwrites-my-html-s/#findComment-328227 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.