📟 ";
$emsm="
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 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() {
//alert(decodeURIComponent(document.URL.replace('%23','#').split('#')[2]));
var bitsare=document.getElementById('moresel').innerHTML.split('#' + decodeURIComponent(document.URL.replace('%23','#').split('#')[1]) + '#');
if (eval('' + bitsare.length) >= 2) {
var newgifis=bitsare[0].split(String.fromCharCode(34))[eval(-1 + bitsare[0].split(String.fromCharCode(34)).length)];
//alert(newgifis);
var newvalis=newgifis + '#' + decodeURIComponent(document.URL.replace('%23','#').split('#')[1]) + '#' + document.getElementById('moresel').innerHTML.split('#' + decodeURIComponent(document.URL.replace('%23','#').split('#')[1]) + '#')[1].split(String.fromCharCode(34))[0];
//alert(newvalis);
document.getElementById('selname').title=decodeURIComponent(document.getElementById('moresel').innerHTML.split('#' + decodeURIComponent(document.URL.replace('%23','#').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','#').split('#')[1]) + '#')[1].split(String.fromCharCode(34))[0]);
}
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','#').split('#').length) >= 3 || (eval('' + document.URL.replace('%23','#').split('#').length) == 2 && document.URL != document.URL.replace(/\#[0-9]/g,''))) { \n
setTimeout(function(){
if (eval('' + document.URL.replace('%23','#').split('#').length) >= 3) {
document.getElementById('selname').title=decodeURIComponent(document.URL.replace('%23','#').split('#')[2]);
if (document.getElementById('dslideshow')) {
document.getElementById('dslideshow').title=decodeURIComponent(document.URL.replace('%23','#').split('#')[2]);
}
}
document.getElementById('moresel').title=decodeURIComponent(document.URL.replace('%23','#').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";
$firstbits = "\n\n
\n\n\nAffine Transformation Rotation and Scale via ImageMagick Primer Tutorial" . $sallbits . "\n\n";
$erroneousbits = "Sorry, but " . $selname . " was not found.
";
$formbits = "\n
";
$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("", $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;
?>