array('width' => 720, 'height' => 720), // Number of pixels by which tiles overlap 'overlap' => array('x' => 70, 'y' => 70), // Zoom level 'zoom_level' => 2, // Start in the middle of the tile set, rather than the top-left corner 'ignore_tiles' => array('x' => 0, 'y' => 0), // Image identifier (I= parameter on initial view page) 'image_id' => 'w013s000g001', // Total number of tiles we're interested in 'tile_count' => array('x' => 3, 'y' => 2), ); $options = sanitise_options( array_merge($default_options, $_GET) ); switch ( $_GET['action'] ) { case 'image': process_and_display_image($options); break; case 'source': header('Content-type: text/plain'); readfile(__FILE__); break; default: display_option_form($options); } function sanitise_options($raw_options) { return array( 'tile_size' => array( 'width' => intval($raw_options['tile_size']['width']), 'height' => intval($raw_options['tile_size']['height']), ), 'overlap' => array( 'x' => intval($raw_options['overlap']['x']), 'y' => intval($raw_options['overlap']['y']) ), 'zoom_level' => intval($raw_options['zoom_level']), 'ignore_tiles' => array( 'x' => intval($raw_options['ignore_tiles']['x']), 'y' => intval($raw_options['ignore_tiles']['y']) ), 'tile_count' => array( 'x' => intval($raw_options['tile_count']['x']), 'y' => intval($raw_options['tile_count']['y']) ), 'image_id' => preg_replace('/[^0-9A-Za-z]/', '', $raw_options['image_id']), ); } function display_option_form($options) { ?>
Script © Rowan Collins 2009, AKA IMSoP
This work is licensed under a Creative Commons Attribution 3.0 Unported License.