Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

[a7b9ef]: packages / web / 353 / php_top / raw.php Maximize Restore History

Download this file

raw.php    49 lines (47 with data), 2.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/*!*******************************************************************************
*! FILE NAME : raw.php
*! DESCRIPTION:
*! Copyright (C) 2008 Elphel, Inc
*! -----------------------------------------------------------------------------**
*!
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*! $Log: raw.php,v $
*! Revision 1.1 2009/10/15 19:42:16 oneartplease
*! added raw demo files
*!
*! Revision 1.2 2008/08/18 06:00:34 elphel
*! Made it acquire one image at a time
*!
*! Revision 1.1 2008/08/18 03:27:06 kimstig
*! Raw image access demo
*!
*!
*/
$name = "/dev/ccam_img";
elphel_compressor_run() ; /// just to make sure it is on (needed for elphel_wait_frame())
elphel_fpga_write(4,4) ; /// Acquire single frame to video buffer
elphel_wait_frame(); /// wait for the next frame to be compressed (just to make sure frame is acquired)
$fp = fopen($name, 'rb');
fseek($fp, 0, SEEK_END); /// file pointer at the end of the file (to find the file size)
$fsize = ftell($fp); /// get file size
fseek($fp, 0, SEEK_SET); /// rewind to the start of the file
/// send the headers
header("Content-Type: application/octet-stream");
header('Content-Disposition: attachment; '.'filename="image.raw"');
header("Content-Length: ".$fsize."\n");
header("Pragma: no-cache\n");
fpassthru($fp); /// send the raw data itself
fclose($fp);