How to pass the local film through php?

I"d like to check,
how to pass the local film through the php video?
suppose I have a profile that is full of slices
but how can I buy each slice via php without changing the name of the clip?
I can read, but only for uploading.
I really don"t know how to upload a file in batches locally.
is there a big god who understands this train of thought?

neither the file name nor the film name does not change
the only thing that will be affected is size
this. Is it possible?


The general idea of

is as follows (I did this before to compress local images), which is actually using php's GD library

<?php
set_time_limit(0);
$p = getDir('code/');
 
foreach($p as $val){
        //$file = "images/3.jpg";
        //header("Content-type: image/jpeg");
        $file_type = substr(strrchr($val,"."),1);
        if ($file_type == 'jpg' || $file_type == 'png' || $file_type == 'gif') {
                $percent = 1;  //
                list($width, $height, $type) = getimagesize($val); //
                //
                $newwidth = $width * $percent;
                $newheight = $height * $percent;
                switch($type){ 
                        case 1:
                                $src_im = imagecreatefromgif($val);
                                break;
                        case 2:
                                $src_im = imagecreatefromjpeg($val);
                                break;
                        case 3:
                                $src_im = imagecreatefrompng($val);
                                break;
                        default:
                                break;
                }
                $dst_im = imagecreatetruecolor($newwidth, $newheight);
                imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
                imagejpeg($dst_im,$val); //
                imagedestroy($dst_im);
                imagedestroy($src_im);
        }
}
echo '';
 
 
function searchDir($path,&$data){
if(is_dir($path)){
$dp=dir($path);
while($file=$dp->read()){
if($file!='.'&& $file!='..'){
searchDir($path.'/'.$file,$data);
}
}
$dp->close();
}
if(is_file($path)){
$data[]=$path;
}
}
 
 
function getDir($dir){
$data=array();
searchDir($dir,$data);
return   $data;
}
 
 
?>
Menu