Location: PHPKode > projects > PHP Cad and Drawing Program > phpcad/movies.php
<?php
session_start();
header("Cache-Control: no-cache");
$pfilez=$_SESSION[pfilez];
$tablesent=$_GET["tablesent"];
$formsent=$_GET[formsent];
$stime=$_GET[stime];
$etime=$_GET[etime];
$ff = str_replace(".tob",".setup",$pfilez);
if (file_exists("./files/$ff")) {
    include("./files/$ff");
} else {
    include("./files/picture.setup");
}

// Catches Form Being Sent ****************

if ($formsent=="makeframes") {
    if (!ereg("^[0-9]{1,5}$",$stime)) $stime = 1;
    if (!ereg("^[0-9]{1,5}$",$etime)) $etime = 5;
    if ($stime < 1) $stime = 1;
    if ($etime < 1) $etime = 1;
    if ($stime > 50000) $stime = 50000;
    if ($stime > $etime) $stime = $etime;
    if (($etime-$stime) > 1000) $etime=$stime+1000;
    echo "<br>stime = $stime   etime = $etime<br>";
    for ($time=$stime; $time<$etime+1; $time++) {
        echo "<img border=0 src='drawimage.php?time=$time'>$time<br>\n";
    }
    echo "<br>";
    $formsent="";
    $time="";
    $_SESSION[flag]=1;
  }

if ($formsent=="mencoder") {
echo "A one line text file called 'mencoder' was written in the<br>";
echo "time directory.  Just enter './mencoder' to run it.<br><br>";
if ($_GET[filmtype]=="mpeg4 (divx4/5)");
    $a="mencoder \*.jpg -mf on:$_GET[filmfps] -ovc lavc -lavcopTs vcodec=mpeg4:$_GET[filmbitrate] -o test.avi\n";
if ($_GET[filmtype]=="msmpeg4 (divx3)");
    $a="mencoder \*.jpg -mf on:$_GET[filmfps] -ovc lavc -lavcopTs vcodec=msmpeg4:$_GET[filmbitrate] -o test.avi\n";
if ($_GET[filmtype]=="mpeg1video (mpg)");
    $a="mencoder \*.jpg -mf on:$_GET[filmfps] -ovc lavc -lavcopTs vcodec=mpeg1video:$_GET[filmbitrate] -o test.mpg\n";

$zz=fopen("./time/mencoder", "w");
fwrite($zz,$a);
fclose($zz);
}

if ($tablesent=="2") {
    $b=opendir("./time");
    while($file = readdir($b)) {
        if (ereg("png$",$file)) unlink("./time/$file");
        if (ereg("jpg$",$file)) unlink("./time/$file");
    }
    echo "<HR><HR><HR>";
    closedir($b);
}

if ($tablesent=="4") {
    $delay=20;
    exec("convert -delay $delay ./time/p*.png ./time/test.gif");
}


// End of Form Catch and back to index.php**************

echo "<html>\n";
echo "<body bgcolor='A2A2A2' link='000000' vlink='000000' alink='000000'>\n";
echo "Must have imagemagick's convert installed to make gifs.<br>\n";
echo "To make .mpgs, I recommend using tmpgenc with wine or mencoder for quality.<br>";
echo "There are also yuv2lav and mpeg1enc tools.<br>\n";
echo "Also note most browsers have a STOP button.<br><hr>\n";

echo "<table width=200><tr><td width=100>sframe</td><td width=100>eframe</td></tr></table>";
echo "<form method='GET' action='$PHP_SELF'>\n";
echo "<input type=text name='stime' value='1' align=top size=10 maxlength=5>&nbsp\n";
echo "<input type=text name='etime' value='5' align=top size=10 maxlength=5>\n";
echo "<input  name='formsent' Type='hidden' value='makeframes'>\n";
echo "<input value='Generate Frames' type='submit'></form>\n";


$onclick[1]="index.php";
$caption[1]="Return To Editor";
$onclick[2]="./movies.php";
$caption[2]="Clear Frames";
$onclick[3]="./movies.php";
$caption[3]="Clear GET variables";
$onclick[4]="./movies.php";
$caption[4]="Convert frames to animated .gif";
$onclick[5]="./time/test.gif";
$caption[5]="Display latest animated .gif";
$onclick[6]="./time/test.mpg";
$caption[6]="Display latest .mpg";
$onclick[7]="./time/test.avi";
$caption[7]="Display latest .avi";
$onclick[8]="./time/index.php";
$caption[8]="Display ALL Frames";

foreach ($caption as $number => $item) {
    echo "<form method='GET' action='$onclick[$number]'>\n";
    echo "<input  name='tablesent' type='hidden' value=$number>\n";
    echo "<input  name='formsent' type='hidden' value=''>\n";
    echo "<input value='$item' type='submit'></form>\n";
}

echo "<form method='GET' action='$PHP_SELF'>\n";
echo "<select name='filmtype'>\n";
    echo "<option>mpeg4 (divx4/5)</option>\n";
    echo "<option>msmpeg4 (divx3)</option>\n";
    echo "<option>mpeg1video (mpg)</option>\n";
echo "</select>\n";
echo "<select name='filmbitrate'>\n";
    echo "<option>vbitrate=500</option>\n";
    echo "<option>vbitrate=700</option>\n";
    echo "<option>vbitrate=900</option>\n";
    echo "<option>vbitrate=1150</option>\n";
    echo "<option>vbitrate=2520</option>\n";
    echo "<option>vbitrate=200</option>\n";
    echo "<option>vbitrate=100</option>\n";
    echo "<option>vbitrate=50</option>\n";
    echo "<option>vbitrate=25</option>\n";
    echo "<option>vbitrate=10</option>\n";
echo "</select>\n";
echo "<select name='filmfps'>\n";
    echo "<option>fps=23.97</option>\n";
    echo "<option>fps=29.97</option>\n";
    echo "<option>fps=5</option>\n";
    echo "<option>fps=10</option>\n";
echo "</select>\n";
echo "<input  name='formsent' Type='hidden' value='mencoder'>\n";
echo "<input value='Make Mencoder Script' type='submit'></form>\n";


?>

<hr></body></html>
Return current item: PHP Cad and Drawing Program