Jump to content

centre align?


pouncer

Recommended Posts

<? 
/* We need this in order to return a picture */ 
header ("Content-type: image/png"); 

$graph_data = array( 
   "question" => "Rating for this item" , 
   "1" => 82 , 
   "2" => 18,
   "3" => 0,
   "4" => 0,
   "5" => 0
	); 

$im = ImageCreate(400, 160);

$background_color = imagecolorallocate($im, 200, 200, 200); 
$text_color = imagecolorallocate($im, 233, 14, 91); 
$bar_color = imagecolorallocate($im, 0, 0, 0); 
$bar_color_fill = imagecolorallocate($im, 150, 150, 255); 

imagefill($im, 0, 0, $background_color); 

ImageString ($im, 5, 95, 5,  $graph_data["question"], $text_color); 

for ($i = 1; $i <= 5; $i++) {
	$space = $i * 80 - 50;
	$text = $i . ": " . $graph_data[$i] . "%";

	ImageString ($im, 2, $space, 130,  $text, $text_color); 
}

for ($i = 1; $i <= 5; $i++) {
	$x1 = $i * 80 - 50;
	$bar_height = 120 - $graph_data[$i];
	$bar_width = $x1 + 20;

	imagerectangle($im, $x1, $bar_height, $bar_width, 120 ,$bar_color);
	imagefill($im, $x1, 120, $bar_color_fill); 
}

echo imagepng($im); 
?>  

 

it shows the image in the top left corner.

 

how do i get it to show in the centre of the page?

Link to comment
Share on other sites

yeah i saw that... i had to upload it to a server first... my local php setup aint supporting the imagecreate() i think... need to figure out what to enable to make that work =) i'm just trying to look through it to see if i can figure something out... but as i said when i added my last post... been awake for more than 30 hours now and also i've never worked with imagecreate()

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.