Jump to content

Line


rashmi_k28

Recommended Posts

This code

 

header("Content-type:image/png");
$x1=100;
$x2=200;
$y1=100;
$y2=200;

$im = @ImageCreate (200, 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,10,100,100,100,$text_color);
//imageline ($im,100,0,0,200,$text_color);
ImagePng ($im);
?>

 

 

This shows the horizaontal line. How to vertical draw the  line with the same height with the fixed point as which is got using the values .

imageline ($im,100,100,100,100,$text_color);

Link to comment
https://forums.phpfreaks.com/topic/128672-line/
Share on other sites

This code should give you a horizontal line

 

$x1=50;
$x2=150;
$y1=100;
$y2=100;

$im = @ImageCreate (200, 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);
ImagePng ($im);

 

This code should give you a vertical line

 

$x1=100;
$x2=100;
$y1=50;
$y2=150;

$im = @ImageCreate (200, 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);
ImagePng ($im);

Link to comment
https://forums.phpfreaks.com/topic/128672-line/#findComment-666893
Share on other sites

Hi,

 

But the line's height reducing and increasing when $y1 value is changed.

 

I just want something like a clock's hour hand.

 

 

Z-index of (0,0) and move in clock wise direction (0-180).

By passing the angle  the line's other end should change without altering the (0,0) position

 

 

Link to comment
https://forums.phpfreaks.com/topic/128672-line/#findComment-666913
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.