How to create png image using php

How to create png image using php,charanpal singh
Share it:
<?php
  header (“Content-type: image/png”);
 $handle = ImageCreate (130, 50) or die (“Cannot Create image”);
  $bg_color = ImageColorAllocate ($handle, 255, 0, 0);
 $txt_color = ImageColorAllocate ($handle, 0, 0, 0);
  ImageTTFText ($handle, 20, 15, 30, 40, $txt_color, “/Fonts/Quel.ttf”, “Quel”);  ImagePng ($handle);
 ?>




<?php  header (“Content-type: image/png”);
 $handle = ImageCreate (130, 50) or die (“Cannot Create image”);
  $bg_color = ImageColorAllocate ($handle, 255, 0, 0);
$txt_color = ImageColorAllocate ($handle, 0, 0, 0);
 ImageString ($handle, 5, 5, 18, “PHP.About.com”, $txt_color);  ImagePng ($handle);
 ?>


<?php
// Create a blank image.
 $image = imagecreatetruecolor(400, 300);
 // Select the background color.
$bg = imagecolorallocate($image, 0, 0, 0);
// Fill the background with the color selected above.
 imagefill($image, 0, 0, $bg);
 // Choose a color for the ellipse.
 $col_ellipse = imagecolorallocate($image, 255, 255, 255);
// Draw the ellipse.
 imageellipse($image, 200, 150, 300, 200, $col_ellipse);
// Output the image. header(“Content-type: image/png”);
imagepng($image);
?>

Developer

charanpal
Charanpal Singh

Share it:

tips

Post A Comment:

0 comments:

Note: only a member of this blog may post a comment.