$panels[$i]['image'] = 'http://www.peculiarcomics.com/vortex/img/' . str_pad($vid[$i * 2], 3, '0', STR_PAD_LEFT) . '.jpg'; $panels[$i]['quote'] = get_quote($vid[$i * 2 + 1]); } $response['panels'] = $panels; return $response; } function generate_url($vortex) { /* The opposite of get_vortex, generates a url for sharing vortex comics. * $vortex - a vortex array object. */ return "http://www.peculiarcomics.com/vortex/index.html?vid=" . $vortex['vid']; } if ($_SERVER['PHP_SELF'] == 'vortex.php') { // equivalent to python if __name__ == "__main__" if (isset($argv)) { foreach ($argv as $k => $v) { if ($k == 0) { continue; } parse_str($v, $tmp); $_REQUEST = array_merge($_REQUEST, $tmp); } } if (isset($_REQUEST['json'])) { $decoded = json_decode($_REQUEST['json']); $vortex = get_vortex($decoded); $encoded = json_encode($vortex); die($encoded); } }
<!DOCTYPE html> <?php //clear a json request variable on index.php unset($_REQUEST['json']); include 'vortex.php'; $vortex = get_vortex(); ?> <html> <head> <style type="text/css"> body { background-image:url('http://peculiarcomics.com/vortex/img/bgtile.jpg'); text-align: center; margin-left: auto; margin-right: auto; } img { border: 0 none; } .expose { padding-top:0px; padding-right:5px; padding-bottom:10px; padding-left:10px; font-style: italic; font-size: 24px; } .panel img { border:10px solid #ffffff;