Commit 58567ad0 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

pass Content-Type (image/jpeg,image/jp4, image/tiff) instead of hardcoded image/jpeg

parent 7e99843a
...@@ -44,10 +44,26 @@ $port0 = 2323; ...@@ -44,10 +44,26 @@ $port0 = 2323;
$pointers = elphel_get_circbuf_pointers(intval($port)-$port0,1); $pointers = elphel_get_circbuf_pointers(intval($port)-$port0,1);
$pointer = $pointers[count($pointers)-1]['circbuf_pointer']; $pointer = $pointers[count($pointers)-1]['circbuf_pointer'];
$contents = file_get_contents("http://$ip:$port/$rel");
$acao = "*";
$ct = "image/jpeg";
// pass some headers from file_get_contents
// $http_response_header is auto populated
foreach($http_response_header as $h){
$hv = explode(":",$h);
if ($hv[0]=="Access-Control-Allow-Origin"){
$acao = trim($hv[1]);
}else if ($hv[0]=="Content-Type"){
$ct = trim($hv[1]);
}
}
// allow CORS // allow CORS
header('Access-Control-Allow-Origin: *'); header("Access-Control-Allow-Origin: $acao");
header('Content-type:image/jpeg'); header("Content-Type: $ct");
echo file_get_contents("http://$ip:$port/$pointer/$rel"); echo $contents;
//echo file_get_contents("http://$ip:$port/$rel"); //echo file_get_contents("http://$ip:$port/$rel");
die(); die();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment