Files
gallery3/modules
Bharat Mediratta a8bb046209 Use readfile() instead of fopen()/fpassthru()/fclose() for brevity.
I've done some tests on a 60M flv and found that there's no difference
in memory consumption with these three approaches:

  public function test() {
    Kohana::close_buffers(false);
    $file = "/home/bharat/basketball.flv";
    if ($fd = fopen($file, "rb")) {
      while (true) {
        $bits = fread($fd, 65535);
        if (strlen($bits) == 0) {
          break;
        }
        print $bits;
        set_time_limit(30);
      }
      fclose($fd);
    }
    Kohana_Log::add("error","test: " . print_r(array(memory_get_peak_usage(true),memory_get_peak_usage(false)),1));
  }

  public function test2() {
    Kohana::close_buffers(false);
    $file = "/home/bharat/basketball.flv";
    $fd = fopen($file, "rb");
    fpassthru($fd);
    fclose($fd);
    Kohana_Log::add("error","test2: " . print_r(array(memory_get_peak_usage(true),memory_get_peak_usage(false)),1));
  }

  public function test3() {
    Kohana::close_buffers(false);
    $file = "/home/bharat/basketball.flv";
    readfile($file);
    Kohana_Log::add("error","test3: " . print_r(array(memory_get_peak_usage(true),memory_get_peak_usage(false)),1));
  }
2010-07-31 11:51:18 -07:00
..
2010-06-07 22:18:09 -07:00
2010-06-18 15:18:56 -07:00