It seems that the system isn't returning the exact file size as the file is opened exclusively by the encoder. I'm sure you are able to get the size of a normal file?
Try to call following function (dos_filesize) instead of 'filesize' function.
Code: Select all
<?php
// outputs e.g. somefile.txt: 1024 bytes
function dos_filesize($fn) {
if (is_file($fn))
return exec('FOR %A IN ("'.$fn.'") DO @ECHO %~zA');
else
return '0';
}
$filename = 'somefile.txt';
echo $filename . ': ' . dos_filesize($filename) . ' bytes';
?>
Regarding multiple extensions issue....
You may replace the following code and test. What I do is, I simply extract the file extension and use that. (I assume you only have video files in that directory as previously mentioned).
Code: Select all
if ( is_file($dir.$file) ){
$ext = substr($file, strrpos($file, '.'));
$sub_file = str_ireplace($ext, ".srt", $dir.$file);
$idx_file = str_ireplace($ext, ".idx", $dir.$file);
$thumb_file = str_ireplace($ext, ".jpg", $dir.$file);
$out_file = str_ireplace($ext, ".drc", $dir.$file);
flv_convert_get_thumb($dir.$file, $sub_file, $idx_file, $thumb_file, $out_file);
}
else{
continue;
}
}