getID3

2016-04-04 3 views
0

ile uzunluk video almak için php ve getID3 kütüphanesi ile dosya videomdan uzunluk video alırım, benim videonun uzunluğu 00:02:03 ama bu çıkış 02:03:00, nasıl değiştirebilirimgetID3

move_uploaded_file($source,$direktori); 
$durasi = getDuration($direktori); 
$endtime = date('H:i:s', strtotime($durasi)); 
echo $endtime; 

function getDuration($file){ 
include_once("getID3/getid3/getid3.php"); 
$getID3 = new getID3; 
$file = $getID3->analyze($file); 
return $file['playtime_string']; 

} 

cevap

0
// Using getid3 library, get duration 
function get_duration($filename){ 

    $getID3 = new getID3; 

    $file = $getID3->analyze($filename); 

    $duration_string = $file['playtime_string']; 

    // Format string to be 00:00:00 
    return format_duration($duration_string); 
} 

// Format to AA::BB:CC 
function format_duration($duration){ 

    // The base case is A:BB 
    if(strlen($duration) == 4){ 
     return "00:0" . $duration; 
    } 
    // If AA:BB 
    else if(strlen($duration) == 5){ 
     return "00:" . $duration; 
    } // If A:BB:CC 
    else if(strlen($duration) == 7){ 
     return "0" . $duration; 
    } 
}