PHP/Graphics Image/Line — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 13:37, 26 мая 2010
Drawing a Line with imageline()
<source lang="html4strict">
<?php
header("Content-type: image/gif"); $image = imagecreate( 200, 200 ); $red = imagecolorallocate($image, 255,0,0); $blue = imagecolorallocate($image, 0,0,255 ); imageline( $image, 0, 0, 199, 199, $blue ); imagegif($image);
?>
</source>
Drawing Lines
<source lang="html4strict">
<?php
header ("Content-type: image/png"); $im = ImageCreate (150, 150); $grey = ImageColorAllocate ($im, 230, 230, 230); $black = ImageColorAllocate ($im, 0, 0, 0); ImageLine($im, 0, 30, 150, 150, $black); ImageLine($im, 0, 150, 150, 30, $black); ImageLine($im, 0, 30, 150, 30, $black); ImageString($im, 3, 5, 5, "Figure 18.6: Lines", $black); ImagePng ($im); ImageDestroy ($im);
?>
</source>
Using imagefill()
<source lang="html4strict">
<?php
header("Content-type: image/gif"); $image = imagecreate( 200, 200 ); $red = imagecolorallocate($image, 255,0,0); $blue = imagecolorallocate($image, 0,0,255 ); imageline( $image, 0, 0, 199, 199, $blue ); imagefill( $image, 0, 199, $blue ); imagegif($image);
?>
</source>