
Code: Select all
<?php
define('SIZEX', 500);
define('SIZEY', 200);
define('FSIZE', 10);
define('Y_AMPL', 3);
define('X_AMPL', 3);
define('Y_PERIOD', 4);
define('X_PERIOD', 4);
define('Y_AMPL2', 15);
define('X_AMPL2', 15);
define('Y_PERIOD2', 50);
define('X_PERIOD2', 50);
$font = 'VeraSans.ttf';
function apply_wave(&$im)
{
$k = rand(0,100);
for ($a = 0; $a < SIZEX; $a++)
imagecopy($im, $im, $a-1, sin($k+$a/X_PERIOD)*X_AMPL + sin($k+$a/X_PERIOD2)*X_AMPL2, $a, 0, 1, SIZEY);
$k = rand(0,100);
for ($a = 0;$a < SIZEY; $a++)
imagecopy($im, $im, sin($k+$a/Y_PERIOD)*Y_AMPL + sin($k+$a/Y_PERIOD2)*Y_AMPL2, $a-1, 0, $a, SIZEX, 1);
}
header('Content-Type: image/png');
$im = imagecreatetruecolor(SIZEX, SIZEY);
imagettftext($im, 50, 0, 28, SIZEY - 52, imagecolorallocate( $im, 0,0,255), $font, 'DevNetwork');
imagettftext($im, 50, 0, 25, SIZEY - 50, imagecolorallocate( $im, 0,0,0), $font, 'DevNetwork');
apply_wave($im);
imagepng($im);
imagedestroy($im);
?>