13
Feb

50 Shades of Grey

categories Aktuelles, Computer, PHP    

Naja, jeder redet doch darüber, oder? 🙂

header("Content-type: image/png");
$head = "50 Shades of Grey";
$im = imagecreate(500,280);
$background_color = imagecolorallocate($im, 0, 0, 0);

$orange = imagecolorallocate($im, 220, 210, 60);
$px = (imagesx($im) - 7.5 * strlen($head)) / 2;
imagestring($im, 3, $px, 9, $head, $orange);

$colc = 5;

for ($i = 0; $i < 500; $i = $i + 50) {
    for ($j = 29; $j < 250; $j = $j + 50) {
        $col = imagecolorallocate($im, $colc, $colc, $colc);
        imagefilledrectangle($im, $i+1, $j+1, $i+49, $j+49, $col);
               
        $coln = str_pad(dechex($colc), 2, "0", STR_PAD_LEFT);
        imagestring($im, 2, $i+2, $j+2, "#".$coln.$coln.$coln, $orange);
        $colc += 5;
    }
} 

imagepng($im);
imagedestroy($im);