Jason Silver

Web Development by CrookedBush.com Inc.

My Journal and Diary

2006

October

Saturday, October 14th, 2006

Petition PHP Script

If you want to convert the signature data to a .png file (using GD Library and the signature data) for any reason, a petition user has written a script which fits the bill.

His name is Tino, and here's his script:

<?php
   header ("Content-type: image/png" );
   $signature = "39 40 39 40";
   $points = explode(" ", $signature);
   $image = imagecreate(250, 65);
   $bgcolor = imagecolorallocate($image, 255, 255, 255);
   $color = imagecolorallocate($image, 0, 0, 0);
   for ($x = 0; $x < count($points) - 2; $x = $x + 2) imageline($image, $points[$x], $points[$x + 1], $points[$x + 2], $points[$x + 3], $color);
   imagepng($image);
   imagedestroy($image);
?>

$signature is the signature data.

You can use this in your pages: <img src="signature.php"> where signature.php is the name of the code above.

Cool eh? Thanks Tino!
~Jason


Tags:webdesign perl_scripts 0 likes