<?php require 'libvirt.php'; $lv = new Libvirt('qemu:///system'); $hn = $lv->get_hostname(); if ($hn == false) { die('Cannot open connection to hypervisor</body></html>'); } $action = array_key_exists('action', $_GET) ? $_GET['action'] : false; $subaction = array_key_exists('subaction', $_GET) ? $_GET['subaction'] : false; if ($action == 'get-screenshot' && array_key_exists('uuid', $_GET)) { if (array_key_exists('width', $_GET) && $_GET['width']) { $tmp = $lv->domain_get_screenshot_thumbnail($_GET['uuid'], $_GET['width']); } else { $tmp = $lv->domain_get_screenshot($_GET['uuid']); } if (!$tmp) { echo $lv->get_last_error() . '<br />'; } else { Header('Content-Type: image/png'); die($tmp); } } ?> <html> <head> <title>Virtual server management</title> </head> <body> <?php require 'header.php';