complete rearrangement an splitting into functions

master
Marc Wäckerlin 9 years ago
parent 33120e071b
commit d919552a3e
  1. 4
      src/index.php

@ -77,7 +77,7 @@ function source($dir, $file, $mime=NULL) {
}
/** Output only a part of a file */
function range($path, $size, $mime) {
function fileRange($path, $size, $mime) {
$ranges = array_map('intval', // Parse the parts into integer
explode('-', // The range separator
// Skip the `bytes=` part of the header
@ -121,7 +121,7 @@ function output($path) {
@ini_set('zlib.output_compression', 'Off');
header('Content-type: ' . $mime);
if (isset($_SERVER['HTTP_RANGE'])) {
range($path, $size, $mime);
fileRange($path, $size, $mime);
} else {
header('Content-Length: ' . $size);
@readfile($file);

Loading…
Cancel
Save