Example #1
0
<?php

// Use the first autoload instead if you don't want to install composer
//require_once '../autoload.php';
require_once '../vendor/autoload.php';
if (!isset($_GET['url'])) {
    exit;
}
$screen = new Screen\Capture($_GET['url']);
if (isset($_GET['w'])) {
    // Width
    $screen->setWidth(intval($_GET['w']));
}
if (isset($_GET['h'])) {
    // Height
    $screen->setHeight(intval($_GET['h']));
}
if (isset($_GET['clipw'])) {
    // Clip Width
    $screen->setClipWidth(intval($_GET['clipw']));
}
if (isset($_GET['cliph'])) {
    // Clip Height
    $screen->setClipHeight(intval($_GET['cliph']));
}
if (isset($_GET['user-agent'])) {
    // User Agent String
    $screen->setUserAgentString($_GET['user-agent']);
}
if (isset($_GET['bg-color'])) {
    // Background Color
Example #2
0
<?php

require_once 'vendor/autoload.php';
if (!isset($_REQUEST['url'])) {
    exit;
}
$screen = new Screen\Capture($_REQUEST['url']);
if (isset($_REQUEST['w'])) {
    // Width
    $screen->setWidth(intval($_REQUEST['w']));
}
if (isset($_REQUEST['h'])) {
    // Height
    $screen->setHeight(intval($_REQUEST['h']));
}
if (isset($_REQUEST['clipw'])) {
    // Clip Width
    $screen->setClipWidth(intval($_REQUEST['clipw']));
}
if (isset($_REQUEST['cliph'])) {
    // Clip Height
    $screen->setClipHeight(intval($_REQUEST['cliph']));
}
if (isset($_REQUEST['download'])) {
    $download = $_REQUEST['download'];
}
$fileLocation = 'test.jpg';
$screen->save($fileLocation);
if (isset($_REQUEST['download']) && $_REQUEST['download']) {
    $parsedUrl = parse_url($_REQUEST['url']);
    $fileName = 'ScreeCapture-' . $parsedUrl['host'] . '.jpg';