function pageController()
{
    $adjectives = ['beautiful', 'so-so', 'hungry', 'sleepy', 'talkative', 'discerning', 'creative', 'excellent', 'war-like', 'mundane'];
    $nouns = ['Mongoose', 'Parrot', 'Mole', 'Burney', 'Nick', 'Tomas', 'Jean', 'Zack', 'MK', 'Ryan'];
    $data = [];
    $data['server'] = createName($adjectives, $nouns);
    return $data;
}
Exemplo n.º 2
0
    }
    function json_decode($str)
    {
        return $jsonMaker->decode($str);
    }
}
// create $hair, $eyes, and $mouth variables
foreach (array("hair", "eyes", "mouth") as $part) {
    if (!empty($_POST[$part])) {
        // FIXME: add [a-zA-Z] matching here:
        ${$part} = $_POST[$part];
    }
}
if (isset($hair) && isset($eyes) && isset($mouth)) {
    $result = array();
    $nick = createName($hair, $eyes, $mouth);
    $outfile = "cache/" . $nick . ".jpg";
    $thumbfile = "cache/." . $nick . "_thumb.jpg";
    if (!file_exists("../" . $outfile)) {
        // TODO: create and cache this image in images/shame/
        $width = 230;
        $height = 326;
        $im = imageCreateTrueColor($width, $height);
        $bgColor = imagecolorallocate($img, 255, 255, 255);
        imagefill($im, 0, 0, $bgColor);
        $parts = array("hair" => array(0, 0, 230, 120), "eyes" => array(0, 120, 230, 94), "mouth" => array(0, 214, 230, 113));
        foreach ($parts as $part => $dst) {
            // copy each slice into the new image
            $tmpfile = "../images/" . ${$part} . ".jpg";
            if (file_exists($tmpfile)) {
                $tmp = imageCreateFromJpeg($tmpfile);