Beispiel #1
0
}
// ************** Chart Processing **************
if ($_REQUEST['act'] == 'graph') {
    $chartType = $_REQUEST['chartType'];
    $smarty->assign('chartType', $chartType);
    // Use a unique file per user.
    if (isset($_REQUEST['cacheKey'])) {
        if (strlen(trim($_REQUEST['cacheKey'])) < 4) {
            $cacheKey = $userId . "-" . rand(1000, 9999);
        } else {
            $cacheKey = $_REQUEST['cacheKey'];
        }
    } else {
        $cacheKey = "";
    }
    cleanupDir("graph/cache/", 86400);
    // TODO: Add code to clean up dir
    $smarty->assign('cacheKey', $cacheKey);
    $cacheFileName = "graph/cache/" . $cacheKey . ".xml";
    if (file_exists($cacheFileName)) {
        unlink($cacheFileName);
    }
    $lineChartTemplate = file_get_contents("graph/default_line_chart_settings.xml.template");
    $scatterChartTemplate = file_get_contents("graph/default_scatter_chart_settings.xml.template");
    if (!file_exists($cacheFileName)) {
        if (sizeOf($jobIds) > 0) {
            if ($chartType == "scatter") {
                $xml = $scatterChartTemplate;
                $xml .= "<data>";
                $xml .= getDataAsAmChartScatterXml($userId, $jobIds, $availFields, $fields, $startDateTime, $endDateTime, $percentile, $trimAbove, $adjustUsing, $trimBelow, $interval);
            } else {
Beispiel #2
0
function generateVideoThumbImages($fileName, $player_id)
{
    require '../variables.php';
    $fileNoSuffix = substr($fileName, 0, strrpos($fileName, "."));
    $mask = "%03d";
    $type = "png";
    $imgPath = $wwwroot . "files/goals/tmp/";
    cleanupDir($imgPath, $player_id);
    // echo "<p>";
    foreach ($result as $line) {
        // echo "[".$line."]<br>";
    }
    // echo "</p>";
    $command = "nice /usr/bin/ffmpeg -i \"" . $wwwroot . "files/goals/" . $fileName . "\" -vcodec " . $type . " -y " . "-r 3 -s sqcif " . $imgPath . $fileNoSuffix . "_" . $mask . "." . $type;
    // echo "<p>command = [".$command."]</p>";
    $result = array();
    $res = exec($command, $result);
    // echo "<p>res=[" + $res + "]</p>";
    return $result;
}
Beispiel #3
0
					
					// remove unneeded images
					for ($i = 0; $i < count($imgFilesArray); $i++) {
						if ((($i+1) < $firstCount) || (($i+1) > $lastCount)) {
							$fileName = $imgFilesArray[$i][0];
							unlink('goals/tmp/'.$fileName);
						}
					} 
					
					// generate
					$fullSrcMask = $wwwroot.$videoThumbsTempDir.$player_id."_*";
					$newAnimName = $fileNoExt."_anim.gif";
					$fullDestFile =  $wwwroot.$videoThumbsDir.$newAnimName;
					
					generateAnimatedGif($fullSrcMask, $fullDestFile);
					cleanupDir($wwwroot.$videoThumbsTempDir, $player_id);
												
					$animImg = '<img src="/'.$videoThumbsDir.$newAnimName.'">';
					?>
						<?php 
echo getBoxTop("Animated GIF&nbsp;<span style='font-weight:normal;font-size:10px;'>(" . $videoThumbsDir . $newAnimName . ")", 0, false, null);
?>
						<?php 
echo $animImg;
?>
						<?php 
echo getBoxBottom();
?>
						<?php 
echo getBoxTop("Save", 0, false, null);
?>