<?php
/**
 *
 * @url         $URL: http://svn.mythtv.org/svn/tags/release-0-24/mythplugins/mythweb/modules/remote/screenshot.php $
 * @date        $Date: 2010-09-11 23:55:38 -0700 (Sat, 11 Sep 2010) $
 * @version     $Revision: 26244 $
 * @author      $Author: xris $
 * @license     GPL
 *
 * @package     MythWeb
 *
/**/

if (empty($_REQUEST['host'])) {
    header('HTTP/1.0 400 Bad Request');
    echo 'No host specified.';
    exit;
}

$frontend = $Frontends[$_REQUEST['host']];
if (empty($frontend)) {
    header('HTTP/1.0 400 Bad Request');
    echo 'Unknown host:  '.$_REQUEST['host'];
    exit;
}

# Build the request
$args = array(
    'format' => strtolower(_or($_REQUEST['format'], 'jpg')),
    'height' => $_REQUEST['height'],
    'width'  => $_REQUEST['width']
    );

# Print the image
header('Content-type: image/'.$args['format']);
echo $frontend->get_screenshot($args);