16 Program to create image with imagestring in PHP

Program:
<?php

    $img = imagecreate(500,300);

    $bgcolor = imagecolorallocate($img,150,200,180);

    $fontcolor = imagecolorallocate($img,120,60,200);



    imagestring($img,3,150,100,"Demo Text1",$fontcolor);

    imagestring($img,6,150,120,"Demo Text2",$fontcolor);

    imagestring($img,9,150,140,"Demo Text3",$fontcolor);

    imagestring($img,12,150,160,"Demo Text4",$fontcolor);



    header("Content-Type: image/png");



    imagepng($img);

    imagedestroy($img);

?>


Output:
Program to create image with imagestring in PHP

Previous
Next Post »