Jump to content

Displaying Graphs


cleeclee

Recommended Posts

I'm having some troubles with displaying the graphs. It shows a broken image when i run it.

Below is my code. I have also attached a picture that should say that my gd library is working? Could i know which part of my code has to be corrected for it to display the graph i want?

<?php
header ("Content-type: image/png");
$x1=$_GET['x1'];
$x2=$_GET['x2'];
$y1=$_GET['y1'];
$y2=$_GET['y2'];

$im = @ImageCreate (100, 200)
or die ("Cannot Initialize new GD image stream");
$background_color = ImageColorAllocate ($im, 224, 234, 234);
$text_color = ImageColorAllocate ($im, 233, 14, 91);

// imageline ($im,$x1,$y1,$x2,$y2,$text_color);
imageline ($im,0,0,100,200,$text_color);
imageline ($im,100,0,0,200,$text_color);


ImagePng ($im);
?>

Edited by Zane
Please make use of our [code] tags
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.