PHP drawing technology

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

1,Picture format: the web site development and common image formatsgif,jpg/jpeg,png .....

Difference:

2,To drawing by PHP programming

<?php

    //The basic steps of drawing technology premise: enable GD Library in the php.ini file

    //Create canvas default background is black
    $img=imagecreatetruecolor(400,300);

    //Draw a variety of graphics
    //Create a color
    $background = imagecolorallocate($img, 255, 0, 0);
    //Draw a circle
    //imageellipse($img,30,30,50,50,$background);
    //Ellipse
    //imageellipse($img,30,30,50,30,$background);
    //Draw a straight line
    //imageline($img,0,0,400,300,$background);
    //Draw a rectangle
    //imagerectangle ($img, 50 , 20 , 100 , 40 , $background);
    //Filled rectangle
    //imagefilledrectangle ($img, 50 , 20 , 100 , 40 , $background);
    //Painting arc
    //imagearc($img, 100, 100, 150, 150, 180, 270, $background);
    //Painting fan type IMG_ARC_CHORD straight line connecting the start and end points   IMG_ARC_PIE
    //imagefilledarc($img, 100, 100, 150, 150, 180, 270, $background,IMG_ARC_PIE);
    
    //Copy pictures to the canvas
/*    $scrImg=imagecreatefromgif('http://www.baidu.com/img/shouye_b5486898c692066bd2cbaeda86d74448.gif');
    $scrImgInfo=getimagesize('http://www.baidu.com/img/shouye_b5486898c692066bd2cbaeda86d74448.gif');
    imagecopy ($img,$scrImg,10,10,0,0,$scrImgInfo[0],$scrImgInfo[1]);
*/
    //imagecopy ($img,$scrImg,10,10,0,0,270,129);
    
    //Write
    //imagestring ($img , 5 , 20 , 20 , "hello,world", $background );
    //Written Chinese
    $str="PHPPainting technology";
    imagettftext ($img , 30 , 0 , 50 ,50, $background , "MSYHBD.TTF" , $str);

    //The output image to webpage (or Ling Cunwei)
    header("content-type: image/png");
    imagepng($img);

    //The destruction of the picture (free memory)
    imagedestroy($img);
?>


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Frederic at October 28, 2013 - 12:24 AM