0

i have large amounts of videos being encoded, and i use this php script to show them via ajax refresh div, my problem is when i have over 100 videos my layout really looks bad and very slow, im been reading about pagination but still do not get it, could somebody help me. thank you

<?Php

function formatBytes($bytes, $precision = 2) {
    $units = array('B', 'KB', 'MB', 'GB', 'TB');
  
    $bytes = max($bytes, 0);
    $pow = floor(($bytes ? log($bytes) : 0) / log(1024));
    $pow = min($pow, count($units) - 1);
  
    $bytes /= pow(1024, $pow);
  
    return round($bytes, $precision) . ' ' . $units[$pow];
}

//define the path as relative
$path = "../encoded";

//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");

echo " ";

while ($file = readdir($dir_handle)) 
{
   
if($file!="$file.avi" && $file!="$file.srt")
if($file!="." && $file!="..")
if($file != ".htaccess")


//Hidden logs

if($file != "x264_2pass.log.temp")
if($file != "ffmpeg2pass-0.log")
if($file != "libx264.bat")
if($file != "x264_2pass.log")
if($file != "x264_2pass.log.mbtree.temp")
if($file != "x264_2pass.log.mbtree")

 
 



    echo $file . ': ' . formatBytes(filesize($path."/".$file), 2) . ' </a><br/>';
}




//closing the directory
closedir($dir_handle);

?>
1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by alex_newbi
0

sorry i forgot to add why isnt this working

echo $file . ': ' . formatBytes(filesize($path."/encoded".$file), 2) . ' </a><br/>';

i want the link to be active so i can download it :(

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.