Jump to content

Overwrites my html :S


thefollower

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/65712-overwrites-my-html-s/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.