📟 "; $hemsmtwo="
"; $emsm=" var wo=null, innards='', modusoperandi='', twaconto=null, twacontoiurl=null, twocontocont='', twacontojurl=null, resis='', gresis='', ssis=''; var gifnameis='', gifcontis='', zhr=null, zform=null, lastduri='', ingif=''; function emailit() { var anchor = document.createElement('a'); anchor.href = 'mailto:?subject=' + encodeURIComponent('Animated GIF Slides' + (document.getElementById('selname').title == '' ? '' : ' ... regarding ' + document.getElementById('selname').title)) + '&body=' + encodeURIComponent(document.URL); anchor.style.display='none'; anchor.innerHTML='Email'; anchor.target='_top'; anchor.click(); } function smsit() { var anchor = document.createElement('a'); anchor.href = 'sms:&body=' + encodeURIComponent(document.URL); anchor.style.display='none'; anchor.innerHTML='Email'; anchor.target='_top'; anchor.click(); } function checkit(iois) { twaconto = (iois.contentWindow || iois.contentDocument); if (twaconto != null) { if (twaconto.document) { twaconto = twaconto.document; } twacontoiurl=document.getElementById('result'); if (twaconto.getElementById('divcopyspan')) { twacontojurl=twaconto.getElementById('divcopyspan'); } //if (twacontoiurl) { setInterval(lookfor, 3000); } } } function ajaxit(gn, gc) { zhr = new XMLHttpRequest(); zform = new FormData(); zform.append('gifname', '' + gn); zform.append('gifcont', '' + gc); zhr.open('post', './animated_gif_slides.php', true); zhr.send(zform); } function checkres() { resis=''; gresis=''; if (document.getElementById('result').innerHTML.indexOf('data:image/gif') != -1) { gresis=document.getElementById('result').innerHTML; resis=''; document.getElementById('result').innerHTML=''; if (ssis != '') { document.getElementById('spagspan').innerHTML=ssis; } gifnameis='diffident_' + Math.floor(Math.random() * 1989786) + '.gif'; lastduri=gresis; ajaxit(gifnameis, gresis); document.getElementById('selname').placeholder=lastduri; if (document.getElementById('audioname').value.trim() != '') { document.getElementById('selname').title=document.getElementById('audioname').value; } document.getElementById('selname').value=document.URL.split('//')[0] + '//' + document.URL.split('//')[1].split('/')[0] + '/tmp/' + gifnameis; setTimeout(laterisgif, 8000); } else if (document.getElementById('result').innerHTML.indexOf('data:image/') != -1) { resis=document.getElementById('result').innerHTML; gresis=''; lastduri=''; if (document.getElementById('audioname').value.trim() != '') { document.getElementById('selname').title=document.getElementById('audioname').value; } document.getElementById('result').innerHTML=''; if (ssis != '') { document.getElementById('spagspan').innerHTML=ssis; } } else if (document.getElementById('result').innerHTML.indexOf('data:') != -1) { document.getElementById('result').innerHTML=''; lastduri=''; if (ssis != '') { document.getElementById('spagspan').innerHTML=ssis; } } document.getElementById('audioname').value=''; if (gresis != '') { document.body.style.backgroundRepeat='no-repeat'; document.body.style.backgroundSize='contain'; document.body.style.background='linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(' + gresis + ')'; } else if (resis != '') { document.body.style.backgroundRepeat='no-repeat'; document.body.style.backgroundSize='contain'; document.body.style.background='linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(' + resis + ')'; } } function laterisgif() { if (document.getElementById('selname').value.indexOf('.gif') != -1) { prefetch(document.getElementById('selname').value); } else if (document.getElementById('selname').value.trim() != '') { document.body.style.backgroundRepeat='no-repeat'; document.body.style.backgroundSize='contain'; document.body.style.background='linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(' + document.getElementById('selname').value + ')'; if (document.getElementById('selname').placeholder != '' && document.getElementById('selname').placeholder == lastduri) { document.getElementById('selname').value=''; lastduri=''; } else { document.getElementById('selname').placeholder=document.getElementById('selname').value; } document.getElementById('selname').value=''; } } function prefetch(whatgifmaybe) { // thanks to https://stackoverflow.com/questions/69564118/how-to-get-duration-of-gif-image-in-javascript#:~:text=Mainly%20use%20parseGIF()%20%2C%20then,duration%20of%20a%20GIF%20image. if ((whatgifmaybe.toLowerCase().trim().split('#')[0] + '?').indexOf('.gif?') != -1 || whatgifmaybe.indexOf('data:image/gif') != -1 || whatgifmaybe.indexOf('gif;base64,') == 0) { ingif=whatgifmaybe; //document.body.style.cursor='progress'; fetch(whatgifmaybe) .then(res => res.arrayBuffer()) .then(ab => isGifAnimated(new Uint8Array(ab))) .then(console.log); } } function isGifAnimated(uint8) { // thanks to https://stackoverflow.com/questions/69564118/how-to-get-duration-of-gif-image-in-javascript#:~:text=Mainly%20use%20parseGIF()%20%2C%20then,duration%20of%20a%20GIF%20image. let duration = 0; for (let i = 0, len = uint8.length; i < len; i++) { if (uint8[i] == 0x21 && uint8[i + 1] == 0xF9 && uint8[i + 2] == 0x04 && uint8[i + 7] == 0x00) { const delay = (uint8[i + 5] << 8) | (uint8[i + 4] & 0xFF); duration += delay < 2 ? 10 : delay; } } if (eval(duration / 100) < 0.11) { document.body.style.backgroundRepeat='no-repeat'; document.body.style.backgroundSize='contain'; document.body.style.background='linear-gradient(rgba(255,255,255,0.6),rgba(255,255,255,0.6)),url(' + document.getElementById('selname').value + ')'; if (document.getElementById('selname').placeholder != '' && document.getElementById('selname').placeholder == lastduri) { document.getElementById('selname').value=''; lastduri=''; } else { document.getElementById('selname').placeholder=document.getElementById('selname').value; } document.getElementById('selname').value=''; //alert('POST'); document.getElementById('myform').method='POST'; } else if (gresis != '') { //alert('GET'); document.getElementById('myform').method='POST'; //'GET'; document.getElementById('myform').action=document.getElementById('myform').action.split('.php')[0] + '.php#75586#' + encodeURIComponent(document.getElementById('selname').value + '#' + document.getElementById('selname').title); //} else { // alert('why'); } //alert('' + eval(duration / 100)); return duration / 100; // if 0.1 is not an animated GIF } function duricheck(oin) { if (oin.value.indexOf('data:') == 0) { document.getElementById('result').innerHTML=oin.value; oin.placeholder=oin.value; oin.value=''; } else if (oin.value.toLowerCase().indexOf('.gif') != -1) { prefetch(oin.value); } } setInterval(checkres, 10000); setTimeout(function(){ ssis=document.getElementById('spagspan').innerHTML; }, 5000); "; function topdf($image, $inpdff) { global $convertpath; $things = explode(".", $inpdff); $pdff = str_replace("." . $things[sizeof($things) - 1], ".pdf", $inpdff); $fhuh = file_get_contents($image); try { $icont = @file_put_contents($inpdff, $fhuh); } catch (Exception $e) { } if (!file_exists($pdff)) exec($convertpath . "convert " . $inpdff . " " . $pdff); if (1 == 2) { // ideas from http://php.net/manual/en/imagick.examples-1.php $img = new Imagick($image); $img->setImageFormat('pdf'); $success = $img->writeImage($inpdff); return file_get_contents($inpdff); } return $pdff; } $scale="1.0"; $angle="0"; $selname = ""; if (isset($_POST['selname'])) $selname = urldecode($_POST['selname']); if (isset($_GET['selname'])) $selname = urldecode($_GET['selname']); if (isset($_POST['angle'])) $angle = urldecode($_POST['angle']); if (isset($_GET['angle'])) $selname = urldecode($_GET['angle']); if (isset($_POST['scale'])) $scale = urldecode($_POST['scale']); if (isset($_GET['scale'])) $scale = urldecode($_GET['scale']); //if (strpos($selname, "/") !== false) $selname = urlencode($selname); $sallbits .= "\n var thissn='" . $selname . "'; \n function fleshout(iois) { var aconto=null, seltocome='', thisiurl=''; aconto = (iois.contentWindow || iois.contentDocument); if (aconto != null) { if (aconto.document) { aconto = aconto.document; } if (aconto.body != null) { var giffys=aconto.body.innerHTML.split(' data-img=\"'); for (var ij=1; ij')[0]; if (thisiurl.toLowerCase().indexOf('.gif') != -1 && thisiurl.replace(/^http\:\/\//g,'').replace(/^https\:\/\//g,'').replace(/^\/\//g,'').replace(/^\//g,'www.rjmprogramming.com.au/').indexOf('rjmprogramming.com.au/') != -1) { if (giffys[ij].indexOf('?p=') != -1) { seltocome+='' + String.fromCharCode(10); } else { seltocome+='' + String.fromCharCode(10); } } } if (seltocome.length > 0) { parent.document.getElementById('moresel').innerHTML+=seltocome; } } } } function repeatworthy() { var bitsare=document.getElementById('moresel').innerHTML.split('#' + decodeURIComponent(document.URL.replace(/\%23/g,'#').split('#')[1]) + '#'); var bitszare=document.getElementById('moresel').innerHTML.split('?p=' + decodeURIComponent(document.URL.replace(/\%23/g,'#').split('#')[1]) + '&'); if (eval('' + bitsare.length) >= 2) { var newgifis=bitsare[0].split(String.fromCharCode(34))[eval(-1 + bitsare[0].split(String.fromCharCode(34)).length)]; var newvalis=newgifis + '#' + decodeURIComponent(document.URL.replace(/\%23/g,'#').split('#')[1]) + '#' + document.getElementById('moresel').innerHTML.split('#' + decodeURIComponent(document.URL.replace(/\%23/g,'#').split('#')[1]) + '#')[1].split(String.fromCharCode(34))[0]; if (eval('' + document.URL.replace(/\%23/g,'#').split('#').length) >= 4) { newvalis+='#' + decodeURIComponent(document.URL.replace(/\%23/g,'#').split('#')[3]); } if (eval('' + document.URL.replace(/\%23/g,'#').split('#').length) < 4) { document.getElementById('selname').title=decodeURIComponent(document.getElementById('moresel').innerHTML.split('#' + decodeURIComponent(document.URL.replace(/\%23/g,'#').split('#')[1]) + '#')[1].split(String.fromCharCode(34))[0]); } if (document.getElementById('dslideshow')) { document.getElementById('dslideshow').title=decodeURIComponent(document.getElementById('moresel').innerHTML.split('#' + decodeURIComponent(document.URL.replace(/\%23/g,'#').split('#')[1]) + '#')[1].split(String.fromCharCode(34))[0]); } newgifis=newgifis.split('#')[0]; if (newgifis.toLowerCase().indexOf('.gif') != -1) { document.getElementById('selname').value=newgifis; } document.getElementById('moresel').value=newvalis; if (document.getElementById('moresel').value.length > 0) { document.getElementById('moresel').title=''; document.getElementById('selname').value=document.getElementById('moresel').value.split('#')[0]; if (document.getElementById('moresel').value != document.getElementById('selname').value) { document.getElementById('moresel').title=decodeURIComponent(document.getElementById('moresel').value.split('#')[1]); document.getElementById('selname').title=decodeURIComponent(document.getElementById('moresel').value.split('#')[eval(-1 + document.getElementById('moresel').value.split('#').length)]); document.getElementById('myform').action=document.getElementById('myform').action.split('.php')[0] + '.php#' + document.getElementById('moresel').title + '#' + encodeURIComponent(document.getElementById('selname').title); if (document.getElementById('selname').outerHTML.split('>')[0].indexOf(' ondblclick=') == -1) { document.getElementById('selname').ondblclick=function(event){ if (event.target.title.length > 0) { window.open('//www.rjmprogramming.com.au/ITblog/?p=' + decodeURIComponent(document.getElementById('moresel').title) + '#content', '_blank','top=100,left=100,width=800,height=800'); } }; } } else { document.getElementById('selname').title=''; document.getElementById('myform').action=document.getElementById('myform').action.split('.php')[0] + '.php'; } } document.getElementById('moresel').value=''; document.body.style.cursor='pointer'; document.getElementById('mysub').click(); setTimeout(function(){ document.getElementById('mysub').style.backgroundColor='lightgreen'; document.body.style.backgroundColor='#a5b5f5'; }, 5000); } else { setTimeout(repeatworthy, 12000); } } if (eval('' + document.URL.replace(/\%23/g,'#').split('#').length) >= 3 || (eval('' + document.URL.replace(/\%23/g,'#').split('#').length) == 2 && document.URL != document.URL.replace(/\#[0-9]/g,''))) { \n setTimeout(function(){ if (eval('' + document.URL.replace(/\%23/g,'#').split('#').length) >= 3) { document.getElementById('selname').title=decodeURIComponent(document.URL.replace(/\%23/g,'#').split('#')[2]); if (document.getElementById('selname').title.indexOf('http') == 0) { document.getElementById('selname').value=document.getElementById('selname').title; if (eval('' + document.URL.replace(/\%23/g,'#').split('#').length) >= 4) { document.getElementById('selname').title=decodeURIComponent(document.URL.replace(/\%23/g,'#').split('#')[3]); document.getElementById('myform').action=document.getElementById('myform').action.split('.php')[0] + '.php#' + decodeURIComponent(document.URL.replace(/\%23/g,'#').split('#')[1]) + '#' + decodeURIComponent(document.URL.replace(/\%23/g,'#').split('#')[2]) + '#' + decodeURIComponent(document.URL.replace(/\%23/g,'#').split('#')[3]); } } if (document.getElementById('dslideshow')) { document.getElementById('dslideshow').title=decodeURIComponent(document.URL.replace(/\%23/g,'#').split('#')[2]); } } document.getElementById('moresel').title=decodeURIComponent(document.URL.replace(/\%23/g,'#').split('#')[1]); document.getElementById('selname').ondblclick=function(event){ if (event.target.title.length > 0) { window.open('//www.rjmprogramming.com.au/ITblog/?p=' + decodeURIComponent(document.getElementById('moresel').title) + '#content', '_blank','top=100,left=100,width=800,height=800'); } }; if (thissn == '') { document.body.style.cursor='progress'; setTimeout(repeatworthy, 12000); } }, 5000); } " . $emsm . " \n \n"; // via colouring_in_was_numbers_guessing_game.php $ifstuff='  '; $firstbits = "\n\n\n\n\nImagemagick Animated GIG Slide Extractor" . $sallbits . "\n\n"; $erroneousbits = "

Sorry, but " . $selname . " was not found.


"; $formbits = "
\n

Animated GIF Image Extractor via ImageMagick Image Url" . $hemsm . "


Url of image file: " . $ifstuff . "

 
" . $hemsmtwo . ""; $suffix = ""; $lastone=0; $cnt=0; $trextras=""; if ($selname != "") { $more=""; if (isset($_POST['pdf']) || isset($_GET['pdf'])) { $more=" if [ -f 'animated_gif_slide.png' ]; then\n " . $convertpath . "convert animated_gif_slide.png animated_gif_slide.pdf \n "; $more.=" elif [ -f 'animated_gif_slide-0.png' ]; then\n "; $more.=" cnt=0 \n"; $more.=' while [ -f "animated_gif_slide-${cnt}.png" ]; do ' . "\n"; $more.=' ' . $convertpath . "convert animated_gif_slide-${cnt}.png animated_gif_slide-${cnt}.pdf \n "; $more.=" cnt=`expr $cnt + 1` \n"; $more.=" done \n"; $more.=" fi\n"; } file_put_contents("animated_gif_slides.ksh", '#!/bin/ksh' . "\n" . 'cd /home/rjmprogr/public_html/PHP; echo y > animated_gif_slide.png; echo y > animated_gif_slide.png; rm -f animated_gif_slide-*.pdf < animated_gif_slide.png 2> /dev/null; rm -f animated_gif_slide.pdf < animated_gif_slide.png 2> /dev/null; rm -f animated_gif_slide-*.png < animated_gif_slide.png 2> /dev/null; rm -f animated_gif_slide.png < animated_gif_slide.png 2> /dev/null; angle=' . $angle . '; scale=' . $scale . '; radians=`perl -e "print $angle * atan2(1,1)/45"` sx=`python3 -c "import math; print (math.cos( $radians ) * $scale)"` rx=`perl -e "print sin( $radians ) * $scale"` ry=`python3 -c "print (-($rx))"` sy="$sx" ' . $convertpath . 'convert ' . $selname . ' -matte -virtual-pixel Transparent \ -affine $sx,$rx,$ry,$sy,0,0 -transform +repage animated_gif_slide.png > affine_rotate_imagemagick.txt 2> affine_rotate_imagemagick.err' . "\n" . $more . "echo y > animated_gif_slides.ksh; rm -f animated_gif_slides.ksh < animated_gif_slides.ksh" . "\n"); exec('echo y > animated_gif_slide.png; echo y > animated_gif_slide.png; rm -f animated_gif_slide-*.pdf < animated_gif_slide.png 2> /dev/null; rm -f animated_gif_slide.pdf < animated_gif_slide.png 2> /dev/null; rm -f animated_gif_slide-*.png < animated_gif_slide.png 2> /dev/null; rm -f animated_gif_slide.png < animated_gif_slide.png 2> /dev/null; angle=' . $angle . '; scale=' . $scale . '; radians=`perl -e "print $angle * atan2(1,1)/45"`; sx=`python3 -c "import math; print (math.cos( $radians ) * $scale)"`; rx=`perl -e "print sin( $radians ) * $scale"`; ry=`python3 -c "print (-($rx))"`; sy="$sx"; ' . $convertpath . 'convert ' . $selname . ' -matte -virtual-pixel Transparent \ -affine $sx,$rx,$ry,$sy,0,0 -transform +repage animated_gif_slide.png > affine_rotate_imagemagick.txt 2> affine_rotate_imagemagick.err'); sleep(5); if (!file_exists("animated_gif_slide.png") && !file_exists("animated_gif_slide-0.png")) { while ($cnt < 10 && !file_exists("animated_gif_slide.png") && !file_exists("animated_gif_slide-0.png")) { sleep(20); $cnt++; } } if (!file_exists("animated_gif_slide.png") && !file_exists("animated_gif_slide-0.png")) { $selname=$selname; } else if (file_exists("animated_gif_slide-0.png")) { if (isset($_POST['pdf']) || isset($_GET['pdf'])) { $fpdf = topdf('animated_gif_slide-0.png', 'animated_gif_slide-0.pdf'); } while (file_exists("animated_gif_slide-" . $lastone . ".png")) { $lastone++; if (isset($_POST['pdf']) || isset($_GET['pdf'])) { if (file_exists("animated_gif_slide-" . $lastone . ".png")) { topdf('animated_gif_slide-' . $lastone . '.png', 'animated_gif_slide-' . $lastone . '.pdf'); } } else if (file_exists("animated_gif_slide-" . $lastone . ".png")) { if ("$lastone" != "0") $trextras.=" 10) { this.title=document.getElementById('selname').title + ' ... " . (1 + $lastone) . "'; }\" src='animated_gif_slide-" . $lastone . ".png'>
Slide " . (1 + $lastone) . " of "; } } $sbits = "\n"; $erroneousbits = ""; $firstbits = str_replace("", $sbits . "", $firstbits); if (isset($_POST['pdf']) || isset($_GET['pdf'])) { $formbits=str_replace("", "

", $formbits); } else { //$formbits=str_replace("", "

", $formbits); $formbits=str_replace("", "

" . str_replace(" of <", " of " . $lastone . " from " . $selname . "<", $trextras) . "
10) { this.title=document.getElementById('selname').title + ' ... 1'; }\" src='animated_gif_slide-0.png'>
Slide 1 of " . $lastone . " from " . $selname . "
", $formbits); } if (file_exists("animated_gif_slides.ksh")) unlink("animated_gif_slides.ksh"); echo $firstbits; $firstbits=""; } else { $sbits = "\n"; $erroneousbits = ""; $firstbits = str_replace("", $sbits . "", $firstbits); if (file_exists("animated_gif_slides.ksh")) unlink("animated_gif_slides.ksh"); echo $firstbits; $firstbits=""; } } else { $erroneousbits = ""; } echo $firstbits; echo $erroneousbits; echo $formbits; ?>