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);

?>

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 :(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.