I have a directory that is continously filled with jpg images. I want to display these images like a movie in a webpage.
What I've tried is:
function slideit() {
$.get("test.php", function(show) { if(show != "") {
document.getElementById("movie").innerHTML="<img src=\"data:image/jpg;base64," + show + "\" />",
setTimeout('slideit()', 0) } } ); };
The PHP file is
function getrunpic()
{
$file=trim(shell_exec('ls directory | sort -n | grep jpg | head -1'));
$file="directory/".$file;
$imagedata = file_get_contents($file);
$pic = base64_encode($imagedata);
unlink($file);
return $pic;
}
echo getrunpic();
I also tried it with JSON encodeing.
The problem is that the data transfer from php to javascript takes too long. (shows only about 8 pics per sec; I need 25).
Does anybody have an idea to make the process faster?
Thanks in advance