Problem with images?
You must generate images into a directory example one image per second
/cam
20160729154102.jpg 29-Jul-2016 18:40 132K
20160729154202.jpg 29-Jul-2016 18:41 132K
and view the one
generate other and delete the first
Ex: /cam.jpg in other directory
The image to view:
/cam.jpg
The directory with the images:
/cam
When view the image, the same in totally downloading (cm.jpg)
otherwise you view the last image in some time that is downloading and some times have an error.
**PHP script (execute with cron every minute)**
<meta http-equiv="refresh" content="60">
<?php
date_default_timezone_set("America/Argentina/Buenos_Aires" ) ;
?>
<!--<meta http-equiv="refresh" content="60">-->
<?
$directory="cam";
$dirint = dir($directory);
while (($archivo = $dirint->read()) !== false)
{
$archivos[$archivo] = $archivo;
}
rsort ($archivos);
foreach ($archivos as $archivo) {
$e=$e+1;
if($e>2){
$file='cam/'.$archivo;
unlink($file);
}
}
foreach ($archivos as $archivo) {
if(preg_match('/jpg/',$archivo)){
$r=$r+1;
$alto =400;
if($r<3){
$file='cam/'.$archivo;
$salida = '<img src="'.$file.'">';
$newfile='cam.jpg';
if (!copy($file, $newfile)) {
echo "failed to copy<br>";
}
/*
if (!copy($file,'capturas/'. $archivo)) {
echo "failed to copy<br>";
}
*/
}
}
}
$dirint->close();
?>
<div align="center">
<?
echo $salida;
?>
</div>
see the sample running:
http://diarionecochea.mobi/camarita/camara.html