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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.