Originally posted by subzero
View Post
Here is my script i made 5 months ago to help a mate..
Code:
<?php
function make($video,$ige){
// where ffmpeg is located
$ffmpeg = '/usr/local/bin/ffmpeg';
//where to save the image
$image = "$ige";
//time to take screenshot at
$interval = 5;
//screenshot size
$size = "100x50";
//ffmpeg command
$cmd = "$ffmpeg -i $video -deinterlace -an -ss $interval -f mjpeg -t 1 -r 1 -y -s $size $image 2>&1";
$return = `$cmd`;
}
$conf["items_per_page"] = 5;
$page = $_GET["page"];
if (!isset($page))
{
$page = 0;
}
$total = 0;
if(!($dp = opendir("files/$_GET[w]"))) die ("Cannot open ./");
$file_array = array();
while ($file = readdir ($dp))
{
if(substr($file,0,1) != '.' and $file != "index.php" and $file != "screens" and $file != "modrule.php")
{
$file_array[] = $file;
}
}
$file_count = count ($file_array);
sort ($file_array);
if ($file_count > 0)
{
$first_record = $page * $conf["items_per_page"];
$last_record = $first_record + $conf["items_per_page"];
while (list($fileIndexValue, $file_name) = each ($file_array))
{
if (($fileIndexValue >= $first_record) AND ($fileIndexValue < $last_record))
{
$where = "files/$_GET[w]/$file_name";
$filename = "files/video/screens/$file_name.jpg";
if (file_exists($filename)){
}else{
$ige = "files/video/screens/$file_name.jpg";
$video = "files/video/$file_name";
make("$video","$ige");
}
echo "<div><img src=\"modrule.php?im=$file_name.jpg\" alt=\"Screen Shots\"/><br/><a href=\"?act=download&f=$_GET[w]&f2=$file_name\">$file_name</a> (". round(filesize($where)/1024,1) . "kb)
</div>";
$FIND = "files/$_GET[w]/$file_name";
$total = $total + filesize($FIND);
}
}
if (($file_count > 0) AND ($page != 0))
{
// previous button
$prev_page = $page -1;
echo "<div>
<a href=\"".$_SERVER["PHP_SELF"]."?page=$prev_page&act=$_GET[act]&w=$_GET[w]\">Prev</a>
</div>";
}
if (($file_count > 0) AND ($last_record < $file_count))
{
// next button
$next_page = $page + 1;
echo "<div>
<a href=\"".$_SERVER["PHP_SELF"]."?page=$next_page&act=$_GET[act]&w=$_GET[w]\">Next</a>
</div>";
}
echo "<div> Directory: $file_count </div>";
if ($file_count == 1)
{
echo "<div>file";
}else{
echo "<div>files";
}
echo " (" . round($total/1024,1) . "kb)</div>";
}
closedir($dp);
?>
Leave a comment: