$width = $request->param('width', 1024); $height = $request->param('height', 768); $files = Minotar::getFilesFromDir("./minecraft/heads"); if ($width >= 1920) { $width = 1920; } if ($height >= 1080) { $height = 1080; } $files = array_slice($files, 500); //list($width, $height) = getimagesize($_GET['image']); $image_p = imagecreatetruecolor($width, $height); $count = 1; foreach ($files as $avatar) { $image = imagecreatefrompng($avatar); imagecopyresampled($image_p, $image, $width * $count, $height * $count, 0, 0, $width, $height, 42, 42); $count++; } header('Content-type: image/png'); imagejpeg($image_p, null, 100); }); respond('/refresh/[:username]', function ($request, $response) { $username = $request->param('username'); $name = Minotar::get($username, true); Header("Location: " . URL . "avatar/{$username}"); }); respond('404', function ($request, $response) { $response->layout('html/template/default.php'); $response->render('html/404.php', array("title" => "404")); }); dispatch();
$avatar = $avatars[$rand]; $name = str_replace('.png', '', $avatar); header("Cache-Control: no-cache, must-revalidate"); header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); WideImage::load("./minecraft/heads/{$name}.png")->resize($size)->output('png'); }); respond('/download/[:username]', function ($request, $response) { $name = $request->param('username', 'char'); $name = Minotar::get($name); $img = WideImage::load("./minecraft/skins/{$name}.png"); header('Content-Disposition: attachment; filename="' . $name . '.png"'); $img->output('.png'); }); respond('/skin/[:username]', function ($request, $response) { $name = $request->param('username', 'char'); $name = Minotar::get($name); $img = WideImage::load("./minecraft/skins/{$name}.png"); $img->output('.png'); }); respond('/all/[:type]?', function ($request, $response) { $type = $request->param('type', 'heads'); $files = Minotar::getFilesFromDir("./minecraft/{$type}"); $response->render('html/all.phtml', array('files' => $files)); }); respond('/wallpaper/[:width]/[:height]?', function ($request, $response) { $width = $request->param('width', 1024); $height = $request->param('height', 768); $files = Minotar::getFilesFromDir("./minecraft/heads"); if ($width >= 1920) { $width = 1920; }