Skip to content

Instantly share code, notes, and snippets.

@nawawi
Created May 26, 2015 19:09
Show Gist options
  • Save nawawi/cfe8ff372f3ff5a955c5 to your computer and use it in GitHub Desktop.
Save nawawi/cfe8ff372f3ff5a955c5 to your computer and use it in GitHub Desktop.
try create rubber stamp / company stamp
<?php
$img = imagecreatetruecolor(200, 200);
// allocate some colors
$white = imagecolorallocate($img, 255, 255, 255);
$red = imagecolorallocate($img, 255, 0, 0);
$green = imagecolorallocate($img, 0, 255, 0);
$blue = imagecolorallocate($img, 0, 0, 255);
$blue1 = imagecolorallocate($img, 102, 104, 230);
imageantialias($img,true); // antialias
imagecolortransparent($img,$black); // transparent
imagearc($img, 100, 100, 100, 100, 0, 360, $blue1);
imagearc($img, 100, 100, 98, 98, 0, 360, $blue1);
imagearc($img, 100, 100, 90, 90, 0, 360, $blue1);
imagearc($img, 100, 100, 88, 88, 0, 360, $blue1);
imagearc($img, 100, 100, 60, 60, 0, 360, $blue1);
imagearc($img, 100, 100, 62, 62, 0, 360, $blue1);
$text="Untung Laju Sdn Bhd * ";
$degrees = ( 360 / strlen($text) );
for( $i=0; $i < strlen($text); $i++ ) {
$a = ( $degrees * $i ) + 35;
$cos = cos(deg2rad($a));
$sin = sin(deg2rad($a));
$x = 0;
$y = 35;
$xt = round($cos * ($x) - $sin * ($y ));
$yt = round($sin * ($x) + $cos * ($y) );
imagettftext($img, 9, 180-($a), 100+$xt, 100+$yt, $blue1, "arial.ttf", $text[$i]); // copy font arial.tff ke same folder
}
header('Content-type: image/png');
imagepng($img);
imagedestroy($img);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment