Anonymous
public text v1 · immutable<?php
$colors = explode(';', $_POST['colors']);
$x = 0;
$y = 0;
$w = 20;
$h = 20;
$im = imagecreatetruecolor($w, $h);
foreach($colors as $c)
{
$color = explode(',', $c);
$col = imagecolorallocate($im, $color[0], $color[1], $color[2]);
imagesetpixel($im, $x, $y, $col);
if ($x == $w)
{
$x = 0;
}
if ($y == $h)
{
$y = 0;
}
}
imagejpeg($im, dirname(__FILE__) . '/im.jpg', 100);
?>