&1",$aret,$retv);
//$videopath=explode("ffmpeg",explode("\n",$videopaths)[-1 + sizeof(explode("\n",$videopaths))])[0]; // $videopaths[-1 + sizeof($videopaths)]; //$aret[0];
//echo $retv . "~" . $videopaths . "*" . $videopath . "^" . $aret[0];
//exit;
$videocmd=$videopath . "ffmpeg -r " . (1000 / $delay) . " -i " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "%03d.jpg " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "video.mp4 2> " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "video.bad";
$svideocmd="ffmpeg -r " . (1000 / $delay) . " -i " . "%03d.jpg " . "video.mp4";
$videohtml=" ";
$videosuffix="";
$agifphp="GetAnimation();
?>
";
$lastbitfrom="echo \$gif->GetAnimation();";
$lastbitto="\$fp = fopen('animegif.gif', 'w');
\$data = \$gif->GetAnimation();
\$dataUri = 'data:image/gif;base64,' . base64_encode(\$data);
fwrite(\$fp, \$data);
fclose(\$fp);
\$fp = fopen('animegif.html', 'w');
fwrite(\$fp, '
Data URI version below ... via web browser (Windows right click, Mac OS X two finger gesture) ... ');
fclose(\$fp);";
$agtext="";
$url="";
function inhouseslideshow($uarray,$uarraydatauri) {
global $agtext, $videocmd, $videopath;
if (sizeof($uarray) == 0) return "";
if (file_exists($videopath . "ffmpeg")) {
exec($videocmd); // exec("`which ffmpeg` " . explode("ffmpeg",$videocmd)[1]);
}
//echo $videocmd;
//exit;
$sofar=" \n";
$sofar.=" \n";
$sofar.="" . $agtext . " - via RJM Programming Slideshow Presentation \n";
$sofar.=" \n ";
$sofar.="" . $agtext . " \n ";
$sofar.=" \n ";
$sofar.=" \n ";
$sofar.="Slideshow version below ... optionally get content via web browser (Windows right click, Mac OS X two finger gesture) ... \n ";
$sofar.=" \n ";
$sofar.=" \n ";
$sofar.="@ --> \n ";
//for ($iqw=1; $iqw--> \n ";
//}
return $sofar . "
\n\n";
}
function server_remote_addr() {
$rma = $_SERVER['REMOTE_ADDR'];
$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
// you can add different browsers with the same way ..
if(preg_match('/(chromium)[ \/]([\w.]+)/', $ua))
$rma = '000000'.$rma;
elseif(preg_match('/(chrome)[ \/]([\w.]+)/', $ua))
$rma = '00000'.$rma;
elseif(preg_match('/(safari)[ \/]([\w.]+)/', $ua))
$rma = '0000'.$rma;
elseif(preg_match('/(opera)[ \/]([\w.]+)/', $ua))
$rma = '000'.$rma;
elseif(preg_match('/(msie)[ \/]([\w.]+)/', $ua))
$rma = '00'.$rma;
elseif(preg_match('/(mozilla)[ \/]([\w.]+)/', $ua))
$rma = '0'.$rma;
return str_replace(":", "_", $rma);
}
function analyze($url) {
//$aprefix="../";
$aprefix="";
if (strpos($url, "//") === false && strpos($_SERVER['SERVER_NAME'], "rjmprogramming.com.au") !== false) return $aprefix;
if (strpos($url, "//") === false && strpos($_SERVER['SERVER_NAME'], "localhost") !== false) return $aprefix;
$aub=$_SERVER['REQUEST_URI'];
$xubf=explode("?", $aub);
$xubf[0]=str_replace("tutorial_to_animated_gif.php", "", str_replace("@!@","", str_replace("@!@/","", "@!@" . $xubf[0])));
$xubff=explode("/", $xubf[0]);
for ($ih=1; $ih 2) {
$xub=str_replace("/" . $xubff[sizeof($xubff) - 1], "/", $xubf[0]);
} else {
$xub=str_replace("@$@", "", str_replace("/@$@", "/", ($xubf[0] . "@$@")));
}
$ubf=explode("?", $url);
$ubff=explode("/", $ubf[0]);
if (strpos($ubff[sizeof($ubff) - 1], ".") !== false && (sizeof($ubff) - 1) > 2) {
$ub=str_replace("/" . $ubff[sizeof($ubff) - 1], "/", $ubf[0]);
} else {
$ub=str_replace("@$@", "", str_replace("/@$@", "/", ($ubf[0] . "@$@")));
}
$preubff=explode("rjmprogramming.com.au:80/", $ub);
if (sizeof($preubff) > 1) {
$aprefix.=$preubff[1];
} else {
$preubff=explode("rjmprogramming.com.au/", $ub);
if (sizeof($preubff) > 1) {
$aprefix.=$preubff[1];
} else {
$preubff=explode("localhost:8888/", $ub);
if (sizeof($preubff) > 1) {
$aprefix.=$preubff[1];
}
}
}
return $aprefix;
}
if (isset($_GET['slideshow']) || isset($_POST['slideshow'])) {
if (isset($_GET['slideshow'])) $url=($_GET['slideshow']);
if (isset($_POST['slideshow'])) $url=($_POST['slideshow']);
if (strpos($url, ' src="') !== false) {
$shtml=$url;
file_put_contents(server_remote_addr() . "_huh.html", $url);
$moreh1=" ... you have 10 seconds to change delay value as necessary";
$imagegifandthen.="document.getElementById('slideshow').value='http://www.rjmprogramming.com.au/PHP/animegif/" . server_remote_addr() . "_huh.html'; setTimeout(and_then,10000); ";
$shtml="";
} else {
if (isset($_GET['slideshow'])) $shtml=@file_get_contents($_GET['slideshow']);
if (isset($_POST['slideshow'])) $shtml=@file_get_contents($_POST['slideshow']);
}
$prefix=analyze($url);
if (isset($_GET['delay'])) $delay=($_GET['delay']);
if (isset($_POST['delay'])) $delay=($_POST['delay']);
$videocmd=$videopath . "ffmpeg -r " . (1000 / $delay) . " -i " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "%03d.jpg " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "video.mp4 2> " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "video.bad";
$svideocmd="ffmpeg -r " . (1000 / $delay) . " -i " . "%03d.jpg " . "video.mp4";
if (!file_exists($videopath . "ffmpeg")) {
$videohtml="No ffmpeg installed, so ... if you have in your local system ... at command line (in download directory, first removing any existant %03d.jpg files such as 001.jpg to 999.jpg) type (to end up with a video.mp4 video) " . $svideocmd . " ... after downloading ... open video.mp4 ";
$videosuffix=" creation advice";
}
$eachone=str_replace("[]=40;", "[]=" . $delay . ";", $eachone);
$gifphp=$agifphp;
if (isset($_GET['stitle'])) $agtext=($_GET['stitle']);
if (isset($_POST['stitle'])) $agtext=($_POST['stitle']);
if (strpos($shtml, ' src="') === false) {
$shtml=' src="' . $url . '" ';
$icnt++;
$jfilep="00";
$ijf=1;
$jf=1;
while (isset($_GET['slideshow' . $icnt]) || isset($_POST['slideshow' . $icnt])) {
if (sizeof($ismulti) == 0) {
if (strpos($url,".") !== false) {
$ismulti[sizeof($ismulti)]=$url;
if (file_exists('video.mp4')) unlink('video.mp4');
if (1 == 1) {
if (file_exists('001.jpg')) {
while (file_exists(substr(($jfilep . $jf),-3) . '.jpg')) {
unlink(substr(($jfilep . $jf),-3) . '.jpg');
$jf++;
}
}
if (file_exists($videopath . "ffmpeg")) {
file_put_contents(substr(($jfilep . $ijf),-3) . '.jpg', file_get_contents($url));
} else {
$videohtml=str_replace("open", "" . $url . " open", $videohtml);
}
$ijf++;
}
$ismultidatauri[sizeof($ismultidatauri)]='data:image/' . str_replace('jpg','jpeg',strtolower(explode('.',$url)[-1 + sizeof(explode('.',$url))])) . ';base64,' . base64_encode(file_get_contents($url));
}
}
if (isset($_GET['slideshow' . $icnt])) {
$url=($_GET['slideshow' . $icnt]);
if (strpos($url,".") !== false) {
$ismulti[sizeof($ismulti)]=$url;
if (file_exists($videopath . "ffmpeg")) {
file_put_contents(substr(($jfilep . $ijf),-3) . '.jpg', file_get_contents($url));
} else {
$videohtml=str_replace("open", "" . $url . " open", $videohtml);
}
$ijf++;
$ismultidatauri[sizeof($ismultidatauri)]='data:image/' . str_replace('jpg','jpeg',strtolower(explode('.',$url)[-1 + sizeof(explode('.',$url))])) . ';base64,' . base64_encode(file_get_contents($url));
}
}
if (isset($_POST['slideshow' . $icnt])) {
$url=($_POST['slideshow' . $icnt]);
if (strpos($url,".") !== false) {
$ismulti[sizeof($ismulti)]=$url;
if (file_exists($videopath . "ffmpeg")) {
file_put_contents(substr(($jfilep . $ijf),-3) . '.jpg', file_get_contents($url));
} else {
$videohtml=str_replace("open", "" . $url . " open", $videohtml);
}
$ijf++;
$ismultidatauri[sizeof($ismultidatauri)]='data:image/' . str_replace('jpg','jpeg',strtolower(explode('.',$url)[-1 + sizeof(explode('.',$url))])) . ';base64,' . base64_encode(file_get_contents($url));
}
}
$shtml.=' src="' . $url . '" ';
$icnt++;
}
if (sizeof($ismulti) > 0) {
$ofp = fopen('slideshow.html', 'w');
fwrite($ofp, inhouseslideshow($ismulti,$ismultidatauri));
fclose($ofp);
$extras=" Animated GIF Video Data URI version Slideshow versions ";
} else {
$extras=" Animated GIF Data URI version ";
}
}
$photos=explode(' src="', $shtml);
if (sizeof($photos) > 1) {
$atext=$agtext;
$wasprefix=$prefix;
for ($io=1; $ioPreview Below ... Animated GIF (Later) (Way) Below ";
$imagegif.=" ";
if (sizeof($ismulti) > 0) {
$imagegifandthen.="document.getElementById('idiv').innerHTML+=\"Preview Above ... Animated GIF then Video" . $videosuffix . " Below Video" . $videosuffix . " below ... " . $videohtml . " Data URI version Top Animated GIF Slideshow Data URI Slideshow " . "\";";
} else {
$imagegifandthen.="document.getElementById('idiv').innerHTML+=\"Preview Above ... Animated GIF Below Top Animated GIF " . "\";";
}
}
} //else {
echo "
Tutorial Slideshow to Animated GIF
Tutorial Slideshow to Animated GIF" . $moreh1 . "
";
//}
?>