PHP/Graphics Image/Triangler

Материал из Web эксперт
Версия от 10:05, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Drawing a Triangler

   <source lang="html4strict">

<?php

    header ("Content-type: image/png");
  
    $im = ImageCreate (175, 175);
  
    $grey = ImageColorAllocate ($im, 230, 230, 230);
    $black = ImageColorAllocate ($im, 0, 0, 0);
  
    $coordinates = array();
  
    $coordinates[0] = 0;            // Point 1 x
    $coordinates[1] = 150;          // Point 1 y
    $coordinates[2] = 150;          // Point 2 x
    $coordinates[3] = 150;          // Point 2 y
    $coordinates[4] = 75;           // Point 3 x
    $coordinates[5] = 75;           // Point 3 y
  
    ImageFilledPolygon($im, $coordinates, 3, $black);
  
    ImageString($im, 3, 5, 5, "Figure 18.4: Triangle", $black);
    ImagePng ($im);
    ImageDestroy ($im);

?>

      </source>