Beispiel #1
0
<?php

include 'common.inc';
require_once 'video.inc';
require_once 'page_data.inc';
$pageData = loadPageRunData($testPath, $run, $cached);
$videoPath = "{$testPath}/video_{$run}";
if ($cached) {
    $videoPath .= '_cached';
}
// get the status messages
$messages = LoadStatusMessages($testPath . '/' . $run . $cachedText . '_status.txt');
// re-build the videos
MoveVideoFiles($testPath);
BuildVideoScript($testPath, $videoPath);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>Web page screen shot</title>
        <meta http-equiv="charset" content="iso-8859-1">
        <meta name="keywords" content="Performance, Optimization, Pagetest, Page Design, CDN, Content Distribution Network">
        <meta name="description" content="Speed up the performance of your web pages with an automated analysis">
        <meta name="author" content="Patrick Meenan">
        <style type="text/css">
            <?php 
include 'pagestyle.css';
?>
        img.center {
            display:block; 
            margin-left: auto;
<?php

chdir('..');
include 'common.inc';
require_once 'video.inc';
$dir = "{$testPath}/video_{$run}";
if ($cached) {
    $dir .= "_cached";
}
$ok = false;
if (is_dir($dir)) {
    $file = "{$dir}/video.zip";
    BuildVideoScript($testPath, $dir);
    ZipVideo($dir);
    if (is_file($file)) {
        header('Content-disposition: attachment; filename=video.zip');
        header('Content-type: application/zip');
        readfile_chunked($file);
        unlink($file);
        $ok = true;
    }
}
if (!$ok) {
    ?>
<!DOCTYPE html>
<html>
    <head>
        <title>WebPagetest - Visual Comparison</title>
        <meta http-equiv="charset" content="iso-8859-1">
        <?php 
    $gaTemplate = 'Video Download Error';
Beispiel #3
0
 $scriptFile = "./video/templates/{$count}.avs";
 if (strlen($_REQUEST['template'])) {
     $scriptFile = "./video/templates/{$_REQUEST['template']}.avs";
 }
 $script = file_get_contents($scriptFile);
 if (strlen($script)) {
     // figure out the job id
     require_once './lib/pclzip.lib.php';
     $zipFile = "./work/video/tmp/{$id}.zip";
     $zip = new PclZip($zipFile);
     if ($zip) {
         // zip up the video files
         foreach ($tests as $index => &$test) {
             // build an appropriate script file for this test
             $startOffset = array_key_exists('pageData', $test) && array_key_exists($test['run'], $test['pageData']) && array_key_exists($test['cached'], $test['pageData'][$test['run']]) && array_key_exists('testStartOffset', $test['pageData'][$test['run']][$test['cached']]) ? $test['pageData'][$test['run']][$test['cached']]['testStartOffset'] : null;
             BuildVideoScript(null, $test['videoPath'], $test['end'], $test['extend'], $startOffset);
             $files = array();
             $dir = opendir($test['videoPath']);
             if ($dir) {
                 while ($file = readdir($dir)) {
                     $path = $test['videoPath'] . "/{$file}";
                     if (is_file($path) && (stripos($file, '.jpg') || stripos($file, '.avs')) && strpos($file, '.thm') === false) {
                         $files[] = $path;
                     }
                 }
                 closedir($dir);
             }
             // update the label in the script
             $script = str_replace("%{$index}%", $test['label'], $script);
             if (count($files)) {
                 $zip->add($files, PCLZIP_OPT_REMOVE_ALL_PATH, PCLZIP_OPT_ADD_PATH, "{$index}");