<?php
// cowsay.php
// RJM Programming
// February, 2025
// Thanks to https://www.linuxquestions.org/questions/programming-9/shell-question-pad-end-of-each-line-with-spaces-to-%3D-80-chars-875082/
   error_reporting(E_ERROR | E_PARSE);

$div_img="div, .iimg"; // div, img 
$ext="";

$headscript=str_replace("\n"," ","<head> 
<scr" . "ipt type=text/javascript> 
  var vwo=null; 
 
  function ondblc(eo) { 
    vwo=top.window.open('','_blank','top=100,left=100,height=600,width=600'); 
    vwo.document.write('<html><body>' + eo.outerHTML + '</body></html>'); 
  } 
 
</scr" . "ipt> 
</head>");

$pts="36";
$fps="2";
if (isset($_POST['fps'])) {
  $wdsa=explode(',',str_replace('+',' ',urldecode($_POST['fps'])));
  if (strlen(trim($wdsa[0])) > 0) {
  $fps='' . $wdsa[0];
  } 
  if (sizeof($wdsa) > 1) {
  if (strlen(trim($wdsa[1])) > 0) {
  $pts='' . $wdsa[1];
  } 
  }
} else if (isset($_GET['fps'])) {
  $wdsa=explode(',',str_replace('+',' ',urldecode($_GET['fps'])));
  if (strlen(trim($wdsa[0])) > 0) {
  $fps='' . $wdsa[0];
  } 
  if (sizeof($wdsa) > 1) {
  if (strlen(trim($wdsa[1])) > 0) {
  $pts='' . $wdsa[1];
  } 
  }
}

$lenv="";
$cont="";
$zipfile="";
$ziparrc=0;
$ziparr=[];
$slidename="";
$filterrework="";
$im_php=null;
$curnum=0;
$sanum=0;
$saname=str_replace("arg0", "arg", "substancearg" . $sanum);
$totnum=-1;
$totlist="";
$curlist="";
if (isset($_GET['promptstring'])) {
  $totlist=str_replace('+',' ',urldecode($_GET['promptstring']));
}
if (isset($_POST['promptstring'])) {
  $totlist=str_replace('+',' ',urldecode($_POST['promptstring']));
}
if (isset($_GET['promptnum'])) {
  $totnum=str_replace('+',' ',urldecode($_GET['promptnum']));
}
if (isset($_POST['promptnum'])) {
  $totnum=str_replace('+',' ',urldecode($_POST['promptnum']));
}
$curlist=$totlist;
$garray1=[];
$garray2=[];
$garray3=[];
$gnum1=-999;
$gnum2=-999;
$gnum3=-999;
$gnum4=-999;
$guide="";

   $slidename='';
   $suff='';
   $three=''; 
   $serious=false;
   $tabbit="";
   $celltemplate='<td id="td1"><table tabspacing=0 tabpadding=0 id="tabtd1"><tbody><tr id="trhtd1"><th id="trthtd1" title="You can edit me." contenteditable="true"></th></tr><tr id="trbtd1"><td ontouchend="toppleme(this);" oncontextmenu="toppleme(this);" ondblclick="reverseme(this);" title="Double click horizontally reverses, and right click vertically topples, and wording above is editable." id="trtdtd1"></td></tr></tbody></table></td>';
   $maybenone='none';
   $moreemojibuttons='';
   if (1 == 1 || isset($_GET['debug'])) {
     $maybenone='block';
     $moreemojibuttons="&nbsp;<span oncontextmenu='event.preventDefault(); fpsit();' title='Video ... right click to adjust frames per second (default 2)' id=spanvideo onclick=\"document.getElementById('divif').src='./cowsay.php?getvideo=' + curcell + '&len=' + document.getElementById('url').value.length;\" disabled>Last Video&#128249;</span>&nbsp;<span oncontextmenu='event.preventDefault(); fpsit();' title='Animated GIF ... right click to adjust frames per second (default 2)' id=spanagif onclick=\"document.getElementById('divif').src='./cowsay.php?getagif=' + curcell + '&len=' + document.getElementById('url').value.length;\" disabled>Last Animated GIF&#128444;</span>";
   }

   
function evc($inxidea, $i_p, $i_m) {
 global $garray1, $garray2, $garray3, $gnum1,$gnum2,$gnum3,$gnum4,$guide, $im_php;
 $anum=1;
 $nnum=1;
 $guide="";
 $garray1=[];
 $garray2=[];
 $garray3=[];
 $gnum1=-999;
 $gnum2=-999;
 $gnum3=-999;
 $gnum4=-999;
 $lasttoken="";
 $inidea=$inxidea;
   //file_put_contents('aazzz.aazzz', $inxidea);
 if (substr($inidea,0,1) == ',') { $inidea=substr($inidea,1);  }
 if (trim($inidea) == '') { return '';  }
 if (strpos('~' . trim($inidea), '~array(') !== false) {
   $lasttoken="array(" . explode(")", explode("array(", $inidea)[1])[0] . ")";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   //file_put_contents('aaczz.aaczz', $lasttoken . ' for ' . $anum);
   eval("\$garray1=" . $lasttoken . ";");
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   //file_put_contents('aazz.aazz', $lasttoken . ' for ' . $anum);
   imageconvolution($i_p, $i_m, $garray1);
   //file_put_contents('aadzz.aadzz', $lasttoken . ' for ' . $anum);
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~[[[') !== false) {
   $lasttoken="[[[" . explode("]]]", explode("[[[", $inidea)[1])[0] . "]]]";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   eval("\$garray1=" . $lasttoken . ";");
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   imageconvolution($i_p, $i_m, $garray1);
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~[[') !== false) {
   $lasttoken="[[" . explode("]]", explode("[[", $inidea)[1])[0] . "]]";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   eval("\$garray1=" . $lasttoken . ";");
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   imageconvolution($i_p, $i_m, $garray1);
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~[') !== false) {
   $lasttoken="[" . explode("]", explode("[", $inidea)[1])[0] . "]";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   eval("\$garray1=" . $lasttoken . ";");
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   imageconvolution($i_p, $i_m, $garray1);
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~-') !== false) {
   if (strpos('~' . trim($inidea), '~-0') !== false || strpos('~' . trim($inidea), '~-1') !== false || strpos('~' . trim($inidea), '~-2') !== false || strpos('~' . trim($inidea), '~-3') !== false || strpos('~' . trim($inidea), '~-4') !== false || strpos('~' . trim($inidea), '~-5') !== false || strpos('~' . trim($inidea), '~-6') !== false || strpos('~' . trim($inidea), '~-7') !== false || strpos('~' . trim($inidea), '~-8') !== false || strpos('~' . trim($inidea), '~-9') !== false) {
   $lasttoken="-" . explode(" ", explode(",", explode("-", $inidea)[1])[0])[0] . "";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   eval("\$gnum1=" . $lasttoken . ";");
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",gnum" . $nnum;
   imageconvolution($i_p, $i_m, $gnum1);
   $nnum++;
   }
   }
 } else if (strpos('~' . trim($inidea), '~0') !== false || strpos('~' . trim($inidea), '~1') !== false || strpos('~' . trim($inidea), '~2') !== false || strpos('~' . trim($inidea), '~3') !== false || strpos('~' . trim($inidea), '~4') !== false || strpos('~' . trim($inidea), '~5') !== false || strpos('~' . trim($inidea), '~6') !== false || strpos('~' . trim($inidea), '~7') !== false || strpos('~' . trim($inidea), '~8') !== false || strpos('~' . trim($inidea), '~9') !== false) {
   $lasttoken=explode(" ", explode(",", $inidea)[0])[0] . "";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   eval("\$gnum1=" . $lasttoken . ";");
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",gnum" . $nnum;
   imageconvolution($i_p, $i_m, $gnum1);
   $nnum++;
   }
 }
 if (substr(trim($inidea),0,1) == ',') { $inidea=substr(trim($inidea),1);  }
 if (trim($inidea) == '') { return '';  }
 if (strpos('~' . trim($inidea), '~array(') !== false) {
   $lasttoken="array(" . explode(")", explode("array(", $inidea)[1])[0] . ")";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($anum == 2) {
   eval("\$garray2=" . $lasttoken . ";");
   } else {
   eval("\$garray1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   if ($anum == 2) {
   imageconvolution($i_p, $i_m, $garray1, $garray2);
   } else {
   imageconvolution($i_p, $i_m, $garray1);
   }
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~[[[') !== false) {
   $lasttoken="[[[" . explode("]]]", explode("[[[", $inidea)[1])[0] . "]]]";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($anum == 2) {
   eval("\$garray2=" . $lasttoken . ";");
   } else {
   eval("\$garray1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   if ($anum == 2) {
   imageconvolution($i_p, $i_m, $garray1, $garray2);
   } else {
   imageconvolution($i_p, $i_m, $garray1);
   }
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~[[') !== false) {
   $lasttoken="[[" . explode("]]", explode("[[", $inidea)[1])[0] . "]]";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($anum == 2) {
   eval("\$garray2=" . $lasttoken . ";");
   } else {
   eval("\$garray1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   if ($anum == 2) {
   imageconvolution($i_p, $i_m, $garray1, $garray2);
   } else {
   imageconvolution($i_p, $i_m, $garray1);
   }
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~[') !== false) {
   $lasttoken="[" . explode("]", explode("[", $inidea)[1])[0] . "]";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($anum == 2) {
   eval("\$garray2=" . $lasttoken . ";");
   } else {
   eval("\$garray1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   imageconvolution($i_p, $i_m, $garray1);
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~-') !== false) {
   if (strpos('~' . trim($inidea), '~-0') !== false || strpos('~' . trim($inidea), '~-1') !== false || strpos('~' . trim($inidea), '~-2') !== false || strpos('~' . trim($inidea), '~-3') !== false || strpos('~' . trim($inidea), '~-4') !== false || strpos('~' . trim($inidea), '~-5') !== false || strpos('~' . trim($inidea), '~-6') !== false || strpos('~' . trim($inidea), '~-7') !== false || strpos('~' . trim($inidea), '~-8') !== false || strpos('~' . trim($inidea), '~-9') !== false) {
   $lasttoken="-" . explode(" ", explode(",", explode("-", $inidea)[1])[0])[0] . "";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($nnum == 2) {
   eval("\$gnum2=" . $lasttoken . ";");
   } else {
   eval("\$gnum1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",gnum" . $nnum;
   if ($anum == 2) {
   imageconvolution($i_p, $i_m, $gnum1, $gnum2);
   } else {
   imageconvolution($i_p, $i_m, $gnum1);
   }
   $nnum++;
   }
   }
 } else if (strpos('~' . trim($inidea), '~0') !== false || strpos('~' . trim($inidea), '~1') !== false || strpos('~' . trim($inidea), '~2') !== false || strpos('~' . trim($inidea), '~3') !== false || strpos('~' . trim($inidea), '~4') !== false || strpos('~' . trim($inidea), '~5') !== false || strpos('~' . trim($inidea), '~6') !== false || strpos('~' . trim($inidea), '~7') !== false || strpos('~' . trim($inidea), '~8') !== false || strpos('~' . trim($inidea), '~9') !== false) {
   $lasttoken=explode(" ", explode(",", $inidea)[0])[0] . "";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($nnum == 2) {
   eval("\$gnum2=" . $lasttoken . ";");
   } else {
   eval("\$gnum1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",gnum" . $nnum;
   if ($anum == 2) {
   imageconvolution($i_p, $i_m, $gnum1, $gnum2);
   } else {
   imageconvolution($i_p, $i_m, $gnum1);
   }
   $nnum++;
   }
 }
 if (substr(trim($inidea),0,1) == ',') { $inidea=substr(trim($inidea),1);  }
 if (trim($inidea) == '') { return '';  }
 if (strpos('~' . trim($inidea), '~array(') !== false) {
   $lasttoken="array(" . explode(")", explode("array(", $inidea)[1])[0] . ")";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($anum == 3) {
   eval("\$garray3=" . $lasttoken . ";");
   } else if ($anum == 2) {
   eval("\$garray2=" . $lasttoken . ";");
   } else {
   eval("\$garray1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   if ($anum == 3) {
   imageconvolution($i_p, $i_m, $garray1, $garray2, $garray3);
   } else if ($anum == 2) {
   imageconvolution($i_p, $i_m, $garray1, $garray2);
   } else {
   imageconvolution($i_p, $i_m, $garray1);
   }
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~[[[') !== false) {
   $lasttoken="[[[" . explode("]]]", explode("[[[", $inidea)[1])[0] . "]]]";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($anum == 3) {
   eval("\$garray3=" . $lasttoken . ";");
   } else if ($anum == 2) {
   eval("\$garray2=" . $lasttoken . ";");
   } else {
   eval("\$garray1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   if ($anum == 3) {
   imageconvolution($i_p, $i_m, $garray1, $garray2, $garray3);
   } else if ($anum == 2) {
   imageconvolution($i_p, $i_m, $garray1, $garray2);
   } else {
   imageconvolution($i_p, $i_m, $garray1);
   }
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~[[') !== false) {
   $lasttoken="[[" . explode("]]", explode("[[", $inidea)[1])[0] . "]]";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($anum == 3) {
   eval("\$garray3=" . $lasttoken . ";");
   } else if ($anum == 2) {
   eval("\$garray2=" . $lasttoken . ";");
   } else {
   eval("\$garray1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   if ($anum == 3) {
   imageconvolution($i_p, $i_m, $garray1, $garray2, $garray3);
   } else if ($anum == 2) {
   imageconvolution($i_p, $i_m, $garray1, $garray2);
   } else {
   imageconvolution($i_p, $i_m, $garray1);
   }
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~[') !== false) {
   $lasttoken="[" . explode("]", explode("[", $inidea)[1])[0] . "]";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($anum == 3) {
   eval("\$garray3=" . $lasttoken . ";");
   } else if ($anum == 2) {
   eval("\$garray2=" . $lasttoken . ";");
   } else {
   eval("\$garray1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   if ($anum == 3) {
   imageconvolution($i_p, $i_m, $garray1, $garray2, $garray3);
   } else if ($anum == 2) {
   imageconvolution($i_p, $i_m, $garray1, $garray2);
   } else {
   imageconvolution($i_p, $i_m, $garray1);
   }
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~-') !== false) {
   if (strpos('~' . trim($inidea), '~-0') !== false || strpos('~' . trim($inidea), '~-1') !== false || strpos('~' . trim($inidea), '~-2') !== false || strpos('~' . trim($inidea), '~-3') !== false || strpos('~' . trim($inidea), '~-4') !== false || strpos('~' . trim($inidea), '~-5') !== false || strpos('~' . trim($inidea), '~-6') !== false || strpos('~' . trim($inidea), '~-7') !== false || strpos('~' . trim($inidea), '~-8') !== false || strpos('~' . trim($inidea), '~-9') !== false) {
   $lasttoken="-" . explode(" ", explode(",", explode("-", $inidea)[1])[0])[0] . "";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($nnum == 3) {
   eval("\$gnum3=" . $lasttoken . ";");
   } else if ($nnum == 2) {
   eval("\$gnum2=" . $lasttoken . ";");
   } else {
   eval("\$gnum1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",gnum" . $nnum;
   if ($anum == 3) {
   imageconvolution($i_p, $i_m, $gnum1, $gnum2, $gnum3);
   } else if ($anum == 2) {
   imageconvolution($i_p, $i_m, $gnum1, $gnum2);
   } else {
   imageconvolution($i_p, $i_m, $gnum1);
   }
   $nnum++;
   }
   }
 } else if (strpos('~' . trim($inidea), '~0') !== false || strpos('~' . trim($inidea), '~1') !== false || strpos('~' . trim($inidea), '~2') !== false || strpos('~' . trim($inidea), '~3') !== false || strpos('~' . trim($inidea), '~4') !== false || strpos('~' . trim($inidea), '~5') !== false || strpos('~' . trim($inidea), '~6') !== false || strpos('~' . trim($inidea), '~7') !== false || strpos('~' . trim($inidea), '~8') !== false || strpos('~' . trim($inidea), '~9') !== false) {
   $lasttoken=explode(" ", explode(",", $inidea)[0])[0] . "";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($nnum == 3) {
   eval("\$gnum3=" . $lasttoken . ";");
   } else if ($nnum == 2) {
   eval("\$gnum2=" . $lasttoken . ";");
   } else {
   eval("\$gnum1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",gnum" . $nnum;
   if ($anum == 3) {
   imageconvolution($i_p, $i_m, $gnum1, $gnum2, $gnum3);
   } else if ($anum == 2) {
   imageconvolution($i_p, $i_m, $gnum1, $gnum2);
   } else {
   imageconvolution($i_p, $i_m, $gnum1);
   }
   $nnum++;
   }
 }
 if ($guide == '') {
   return '';
 }
 return $guide;
}

   
function evl($inxidea, $i_p, $i_m) {
 global $garray1, $garray2, $garray3, $gnum1,$gnum2,$gnum3,$gnum4,$guide, $im_php;
 $anum=1;
 $nnum=1;
 $guide="";
 $garray1=[];
 $garray2=[];
 $garray3=[];
 $gnum1=-999;
 $gnum2=-999;
 $gnum3=-999;
 $gnum4=-999;
 $lasttoken="";
 $inidea=$inxidea;
   //file_put_contents('aazzz.aazzz', $inxidea);
 if (substr($inidea,0,1) == ',') { $inidea=substr($inidea,1);  }
 if (trim($inidea) == '') { return '';  }
 if (strpos('~' . trim($inidea), '~array(') !== false) {
   $lasttoken="array(" . explode(")", explode("array(", $inidea)[1])[0] . ")";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   //file_put_contents('aaczz.aaczz', $lasttoken . ' for ' . $anum);
   eval("\$garray1=" . $lasttoken . ";");
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   //file_put_contents('aazz.aazz', $lasttoken . ' for ' . $anum);
   imagefilter($i_p, $i_m, $garray1);
   //file_put_contents('aadzz.aadzz', $lasttoken . ' for ' . $anum);
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~[[[') !== false) {
   $lasttoken="[[[" . explode("]]]", explode("[[[", $inidea)[1])[0] . "]]]";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   eval("\$garray1=" . $lasttoken . ";");
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   imagefilter($i_p, $i_m, $garray1);
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~[[') !== false) {
   $lasttoken="[[" . explode("]]", explode("[[", $inidea)[1])[0] . "]]";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   eval("\$garray1=" . $lasttoken . ";");
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   imagefilter($i_p, $i_m, $garray1);
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~[') !== false) {
   $lasttoken="[" . explode("]", explode("[", $inidea)[1])[0] . "]";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   eval("\$garray1=" . $lasttoken . ";");
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   imagefilter($i_p, $i_m, $garray1);
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~-') !== false) {
   if (strpos('~' . trim($inidea), '~-0') !== false || strpos('~' . trim($inidea), '~-1') !== false || strpos('~' . trim($inidea), '~-2') !== false || strpos('~' . trim($inidea), '~-3') !== false || strpos('~' . trim($inidea), '~-4') !== false || strpos('~' . trim($inidea), '~-5') !== false || strpos('~' . trim($inidea), '~-6') !== false || strpos('~' . trim($inidea), '~-7') !== false || strpos('~' . trim($inidea), '~-8') !== false || strpos('~' . trim($inidea), '~-9') !== false) {
   $lasttoken="-" . explode(" ", explode(",", explode("-", $inidea)[1])[0])[0] . "";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   eval("\$gnum1=" . $lasttoken . ";");
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",gnum" . $nnum;
   imagefilter($i_p, $i_m, $gnum1);
   $nnum++;
   }
   }
 } else if (strpos('~' . trim($inidea), '~0') !== false || strpos('~' . trim($inidea), '~1') !== false || strpos('~' . trim($inidea), '~2') !== false || strpos('~' . trim($inidea), '~3') !== false || strpos('~' . trim($inidea), '~4') !== false || strpos('~' . trim($inidea), '~5') !== false || strpos('~' . trim($inidea), '~6') !== false || strpos('~' . trim($inidea), '~7') !== false || strpos('~' . trim($inidea), '~8') !== false || strpos('~' . trim($inidea), '~9') !== false) {
   $lasttoken=explode(" ", explode(",", $inidea)[0])[0] . "";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   eval("\$gnum1=" . $lasttoken . ";");
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",gnum" . $nnum;
   imagefilter($i_p, $i_m, $gnum1);
   $nnum++;
   }
 }
 if (substr(trim($inidea),0,1) == ',') { $inidea=substr(trim($inidea),1);  }
 if (trim($inidea) == '') { return '';  }
 if (strpos('~' . trim($inidea), '~array(') !== false) {
   $lasttoken="array(" . explode(")", explode("array(", $inidea)[1])[0] . ")";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($anum == 2) {
   eval("\$garray2=" . $lasttoken . ";");
   } else {
   eval("\$garray1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   if ($anum == 2) {
   imagefilter($i_p, $i_m, $garray1, $garray2);
   } else {
   imagefilter($i_p, $i_m, $garray1);
   }
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~[[[') !== false) {
   $lasttoken="[[[" . explode("]]]", explode("[[[", $inidea)[1])[0] . "]]]";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($anum == 2) {
   eval("\$garray2=" . $lasttoken . ";");
   } else {
   eval("\$garray1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   if ($anum == 2) {
   imagefilter($i_p, $i_m, $garray1, $garray2);
   } else {
   imagefilter($i_p, $i_m, $garray1);
   }
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~[[') !== false) {
   $lasttoken="[[" . explode("]]", explode("[[", $inidea)[1])[0] . "]]";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($anum == 2) {
   eval("\$garray2=" . $lasttoken . ";");
   } else {
   eval("\$garray1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   if ($anum == 2) {
   imagefilter($i_p, $i_m, $garray1, $garray2);
   } else {
   imagefilter($i_p, $i_m, $garray1);
   }
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~[') !== false) {
   $lasttoken="[" . explode("]", explode("[", $inidea)[1])[0] . "]";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($anum == 2) {
   eval("\$garray2=" . $lasttoken . ";");
   } else {
   eval("\$garray1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   imagefilter($i_p, $i_m, $garray1);
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~-') !== false) {
   if (strpos('~' . trim($inidea), '~-0') !== false || strpos('~' . trim($inidea), '~-1') !== false || strpos('~' . trim($inidea), '~-2') !== false || strpos('~' . trim($inidea), '~-3') !== false || strpos('~' . trim($inidea), '~-4') !== false || strpos('~' . trim($inidea), '~-5') !== false || strpos('~' . trim($inidea), '~-6') !== false || strpos('~' . trim($inidea), '~-7') !== false || strpos('~' . trim($inidea), '~-8') !== false || strpos('~' . trim($inidea), '~-9') !== false) {
   $lasttoken="-" . explode(" ", explode(",", explode("-", $inidea)[1])[0])[0] . "";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($nnum == 2) {
   eval("\$gnum2=" . $lasttoken . ";");
   } else {
   eval("\$gnum1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",gnum" . $nnum;
   if ($anum == 2) {
   imagefilter($i_p, $i_m, $gnum1, $gnum2);
   } else {
   imagefilter($i_p, $i_m, $gnum1);
   }
   $nnum++;
   }
   }
 } else if (strpos('~' . trim($inidea), '~0') !== false || strpos('~' . trim($inidea), '~1') !== false || strpos('~' . trim($inidea), '~2') !== false || strpos('~' . trim($inidea), '~3') !== false || strpos('~' . trim($inidea), '~4') !== false || strpos('~' . trim($inidea), '~5') !== false || strpos('~' . trim($inidea), '~6') !== false || strpos('~' . trim($inidea), '~7') !== false || strpos('~' . trim($inidea), '~8') !== false || strpos('~' . trim($inidea), '~9') !== false) {
   $lasttoken=explode(" ", explode(",", $inidea)[0])[0] . "";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($nnum == 2) {
   eval("\$gnum2=" . $lasttoken . ";");
   } else {
   eval("\$gnum1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",gnum" . $nnum;
   if ($anum == 2) {
   imagefilter($i_p, $i_m, $gnum1, $gnum2);
   } else {
   imagefilter($i_p, $i_m, $gnum1);
   }
   $nnum++;
   }
 }
 if (substr(trim($inidea),0,1) == ',') { $inidea=substr(trim($inidea),1);  }
 if (trim($inidea) == '') { return '';  }
 if (strpos('~' . trim($inidea), '~array(') !== false) {
   $lasttoken="array(" . explode(")", explode("array(", $inidea)[1])[0] . ")";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($anum == 3) {
   eval("\$garray3=" . $lasttoken . ";");
   } else if ($anum == 2) {
   eval("\$garray2=" . $lasttoken . ";");
   } else {
   eval("\$garray1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   if ($anum == 3) {
   imagefilter($i_p, $i_m, $garray1, $garray2, $garray3);
   } else if ($anum == 2) {
   imagefilter($i_p, $i_m, $garray1, $garray2);
   } else {
   imagefilter($i_p, $i_m, $garray1);
   }
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~[[[') !== false) {
   $lasttoken="[[[" . explode("]]]", explode("[[[", $inidea)[1])[0] . "]]]";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($anum == 3) {
   eval("\$garray3=" . $lasttoken . ";");
   } else if ($anum == 2) {
   eval("\$garray2=" . $lasttoken . ";");
   } else {
   eval("\$garray1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   if ($anum == 3) {
   imagefilter($i_p, $i_m, $garray1, $garray2, $garray3);
   } else if ($anum == 2) {
   imagefilter($i_p, $i_m, $garray1, $garray2);
   } else {
   imagefilter($i_p, $i_m, $garray1);
   }
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~[[') !== false) {
   $lasttoken="[[" . explode("]]", explode("[[", $inidea)[1])[0] . "]]";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($anum == 3) {
   eval("\$garray3=" . $lasttoken . ";");
   } else if ($anum == 2) {
   eval("\$garray2=" . $lasttoken . ";");
   } else {
   eval("\$garray1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   if ($anum == 3) {
   imagefilter($i_p, $i_m, $garray1, $garray2, $garray3);
   } else if ($anum == 2) {
   imagefilter($i_p, $i_m, $garray1, $garray2);
   } else {
   imagefilter($i_p, $i_m, $garray1);
   }
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~[') !== false) {
   $lasttoken="[" . explode("]", explode("[", $inidea)[1])[0] . "]";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($anum == 3) {
   eval("\$garray3=" . $lasttoken . ";");
   } else if ($anum == 2) {
   eval("\$garray2=" . $lasttoken . ";");
   } else {
   eval("\$garray1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",garray" . $anum;
   if ($anum == 3) {
   imagefilter($i_p, $i_m, $garray1, $garray2, $garray3);
   } else if ($anum == 2) {
   imagefilter($i_p, $i_m, $garray1, $garray2);
   } else {
   imagefilter($i_p, $i_m, $garray1);
   }
   $anum++;
   }
 } else if (strpos('~' . trim($inidea), '~-') !== false) {
   if (strpos('~' . trim($inidea), '~-0') !== false || strpos('~' . trim($inidea), '~-1') !== false || strpos('~' . trim($inidea), '~-2') !== false || strpos('~' . trim($inidea), '~-3') !== false || strpos('~' . trim($inidea), '~-4') !== false || strpos('~' . trim($inidea), '~-5') !== false || strpos('~' . trim($inidea), '~-6') !== false || strpos('~' . trim($inidea), '~-7') !== false || strpos('~' . trim($inidea), '~-8') !== false || strpos('~' . trim($inidea), '~-9') !== false) {
   $lasttoken="-" . explode(" ", explode(",", explode("-", $inidea)[1])[0])[0] . "";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($nnum == 3) {
   eval("\$gnum3=" . $lasttoken . ";");
   } else if ($nnum == 2) {
   eval("\$gnum2=" . $lasttoken . ";");
   } else {
   eval("\$gnum1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",gnum" . $nnum;
   if ($anum == 3) {
   imagefilter($i_p, $i_m, $gnum1, $gnum2, $gnum3);
   } else if ($anum == 2) {
   imagefilter($i_p, $i_m, $gnum1, $gnum2);
   } else {
   imagefilter($i_p, $i_m, $gnum1);
   }
   $nnum++;
   }
   }
 } else if (strpos('~' . trim($inidea), '~0') !== false || strpos('~' . trim($inidea), '~1') !== false || strpos('~' . trim($inidea), '~2') !== false || strpos('~' . trim($inidea), '~3') !== false || strpos('~' . trim($inidea), '~4') !== false || strpos('~' . trim($inidea), '~5') !== false || strpos('~' . trim($inidea), '~6') !== false || strpos('~' . trim($inidea), '~7') !== false || strpos('~' . trim($inidea), '~8') !== false || strpos('~' . trim($inidea), '~9') !== false) {
   $lasttoken=explode(" ", explode(",", $inidea)[0])[0] . "";
   if (strpos(str_replace('`',' ',$lasttoken),' ') === false) {
   if ($nnum == 3) {
   eval("\$gnum3=" . $lasttoken . ";");
   } else if ($nnum == 2) {
   eval("\$gnum2=" . $lasttoken . ";");
   } else {
   eval("\$gnum1=" . $lasttoken . ";");
   }
   $inidea=explode($lasttoken, $inidea)[1];
   $guide.=",gnum" . $nnum;
   if ($anum == 3) {
   imagefilter($i_p, $i_m, $gnum1, $gnum2, $gnum3);
   } else if ($anum == 2) {
   imagefilter($i_p, $i_m, $gnum1, $gnum2);
   } else {
   imagefilter($i_p, $i_m, $gnum1);
   }
   $nnum++;
   }
 }
 if ($guide == '') {
   return '';
 }
 return $guide;
}
   
function testgif($infbit) {
   if (strpos(strtolower($infbit . '~'), '.gif ~') !== false) {
     return ' -i ' . explode(' -i ', $infbit)[1];
   }
   return $infbit;
}

 function ourfile_get_contents($ourfilename) {
   global $zipfile, $ziparrc, $ziparr, $ext, $slidename;
   if ($ourfilename == $slidename) { return file_get_contents($ourfilename);  }
   return $ourfilename;
   if (trim($zipfile) == "") {
     if (substr(($ourfilename . "     "),0,5) == "data:") {
       $ext="." . 
       explode("/", explode(";base64,", str_replace(" ","+",$ourfilename))[0])[-1 + sizeof(explode("/", explode(";base64,", str_replace(" ","+",$ourfilename))[0]))];   // /jpeg;
       return base64_decode(explode(";base64,", str_replace(" ","+",$ourfilename))[1]);
     }
     return file_get_contents($ourfilename);
   } else if (sizeof($ziparrc) == sizeof($ziparr)) {
     for ($iop=0; $iop<sizeof($ziparr); $iop++) {
       if ($ziparr[$iop] == $ourfilename) {
        //if ($iop > 5) {
        //echo strlen($ziparrc[$iop]) . ' vS ' . $ext . ' ' . $iop . ' ' . sizeof($ziparr) . ' ' . $ourfilename;
        //exit;
        //}
        $zas=$ziparrc[$iop];
        //$ziparrc[$iop]="";
        return $zas;
       }
     }
     return "";
   } else {
     $zip = zip_open($zipfile);
     if ($zip) {
      while ($zip_entry = zip_read($zip)) {
       $thisfilename=zip_entry_name($zip_entry);
       if ($thisfilename == $ourfilename) {
        //echo $thisfilename . ' VS ' . $ourfilename;
        //exit;
        $zhuh=zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
        zip_close($zip);
        return $zhuh;
       }
      }
      zip_close($zip);
     }
   }
   return "";
 }
 
 function imagewhat($i_p, $s_n) {
    global $im_php, $slidename;
    if (strpos(strtolower($slidename), '.jp') !== false) {
      imagejpeg($im_php, $slidename);
      return 'jpeg';
    }
    if (strpos(strtolower($slidename), '.png') !== false) {
      imagepng($im_php, $slidename);
      return 'png';
    }
    if (strpos(strtolower($slidename), '.gif') !== false) {
      imagegif($im_php, $slidename);
      return 'gif';
    }
    if (strpos(strtolower($slidename), '.bmp') !== false) {
      imagebmp($im_php, $slidename);
      return 'bmp';
    }
    return 'jpeg';  
 }

 function new_content($zfilename) {
    global $div_img, $ext, $lenv, $cont, $slidename, $filterrework, $im_php, $sanum, $saname, $totlist, $totnum, $curnum, $curlist;
    $mimet="";
    if (isset($_GET['emboss']) || isset($_POST['emboss']) && ($totlist == "" || strpos($curlist, 'emboss') !== false)) {
      //file_put_contents("qwe.qwe", substr($zfilename,0,100));
      //file_put_contents("qwe.qwex", $_SERVER['HTTP_REFERER']);
      $im_php = imagecreatefromstring(ourfile_get_contents($zfilename));
      //file_put_contents("qwe.qwe2", substr($zfilename,0,100));
      $emboss = array([-2, -1, 0], [-1, 1, 1], [0, 1, 2]);
      //imageconvolution($im_php, $emboss, 1, 0);    
      //file_put_contents("qwe.qwe3", substr($zfilename,0,100));
      if (isset($_GET[$saname]) || isset($_POST[$saname])) {
      if (isset($_GET[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_GET[$saname])), $im_php, IMG_FILTER_EMBOSS) == '') {
      imagefilter($im_php, IMG_FILTER_EMBOSS);
      }
      } else if (isset($_POST[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_POST[$saname])), $im_php, IMG_FILTER_EMBOSS) == '') {
      imagefilter($im_php, IMG_FILTER_EMBOSS);
      }
      } else {
      imagefilter($im_php, IMG_FILTER_EMBOSS);
      }
      } else {
      imagefilter($im_php, IMG_FILTER_EMBOSS);
      }
      //file_put_contents("qwe.qwe4", $slidename);
      $new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      //file_put_contents("qwe.qwe5", $slidename);
      $mimet=imagewhat($im_php, $slidename); //, $new_name);
      //file_put_contents("qwe.qwe6", $mimet);
      $qpzm='data:image/' . $mimet . ';base64,' . base64_encode(ourfile_get_contents($slidename)); //$new_name));
      imagedestroy($im_php);
      // unlink($new_name);
      if ($filterrework == '') {  $filterrework.=" setTimeout(function(){   window.parent.scrollTo(0,0); }, 20000); "; }
      if (('' . $lenv) == '0' || ('' . $lenv) == '1') {  $filterrework.=" if (parent.document.getElementById('i" . (-1 + $lenv) . "')) { parent.document.getElementById('i" . $lenv . "').src='" . $qpzm . "';  } ";  }
      $filterrework.=" parent.document.getElementById('i" . (-1 + $lenv) . "').src='" . $qpzm . "'; ";
      //file_put_contents("qwe.qwe7", file_get_contents($slidename));
      $sanum++;
      $saname=str_replace("arg0", "arg", "substancearg" . $sanum);
      $curnum++;
      if ($curnum >= $totnum) { $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist; return file_get_contents($slidename);  }  //$qpzm;
      $curlist=str_replace('emboss','',$curlist);
      return new_content(file_get_contents($slidename));
    } else if (isset($_GET['negedge']) || isset($_POST['negedge']) && ($totlist == "" || strpos($curlist, 'negedge') !== false)) {
      $im_php = imagecreatefromstring(ourfile_get_contents($zfilename));
      $edge_detect = array([-1, -1, -1], [-1, 8, -1], [-1, -1, -1]);
      if (isset($_GET[$saname]) || isset($_POST[$saname])) {
      if (isset($_GET[$saname])) {
      if (evc(str_replace('+',' ',urldecode($_GET[$saname])), $im_php, $edge_detect) == '') {
      imageconvolution($im_php, $edge_detect, 1, 0);
      }
      } else if (isset($_POST[$saname])) {
      if (evc(str_replace('+',' ',urldecode($_POST[$saname])), $im_php, $edge_detect) == '') {
      imageconvolution($im_php, $edge_detect, 1, 0);
      }
      } else {
      imageconvolution($im_php, $edge_detect, 1, 0);
      }
      } else {
      imageconvolution($im_php, $edge_detect, 1, 0);
      }
      //imageconvolution($im_php, $edge_detect, 1, 255);
      $new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      $mimet=imagewhat($im_php, $slidename); //, $new_name);
      $qpzm='data:image/' . $mimet . ';base64,' . base64_encode(ourfile_get_contents($slidename)); //$new_name));
      imagedestroy($im_php);
      // unlink($new_name);
      if ($filterrework == '') {  $filterrework.=" setTimeout(function(){   window.parent.scrollTo(0,0); }, 20000); "; }
      if (('' . $lenv) == '0' || ('' . $lenv) == '1') {  $filterrework.=" if (parent.document.getElementById('i" . (-1 + $lenv) . "')) { parent.document.getElementById('i" . $lenv . "').src='" . $qpzm . "';  } ";  }
      $filterrework.=" parent.document.getElementById('i" . (-1 + $lenv) . "').src='" . $qpzm . "'; ";
      $sanum++;
      $saname=str_replace("arg0", "arg", "substancearg" . $sanum);
      $curnum++;
      if ($curnum >= $totnum) { $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist; return file_get_contents($slidename);  }  //$qpzm;
      $curlist=str_replace('negedge','',$curlist);
      return new_content(file_get_contents($slidename));
    } else if (isset($_GET['edge']) || isset($_POST['edge']) && ($totlist == "" || strpos($curlist, 'edge') !== false)) {
      $im_php = imagecreatefromstring(ourfile_get_contents($zfilename));
      $edge_detect = array([-1, -1, -1], [-1, 8, -1], [-1, -1, -1]);
      if (isset($_GET[$saname]) || isset($_POST[$saname])) {
      if (isset($_GET[$saname])) {
      if (evc(str_replace('+',' ',urldecode($_GET[$saname])), $im_php, $edge_detect) == '') {
      imageconvolution($im_php, $edge_detect, 1, 0);
      imageconvolution($im_php, $edge_detect, 1, 255);
      }
      } else if (isset($_POST[$saname])) {
      if (evc(str_replace('+',' ',urldecode($_POST[$saname])), $im_php, $edge_detect) == '') {
      imageconvolution($im_php, $edge_detect, 1, 0);
      imageconvolution($im_php, $edge_detect, 1, 255);
      }
      } else {
      imageconvolution($im_php, $edge_detect, 1, 0);
      imageconvolution($im_php, $edge_detect, 1, 255);
      }
      } else {
      imageconvolution($im_php, $edge_detect, 1, 0);
      imageconvolution($im_php, $edge_detect, 1, 255);
      }
      $new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      $mimet=imagewhat($im_php, $slidename); //, $new_name);
      $qpzm='data:image/' . $mimet . ';base64,' . base64_encode(ourfile_get_contents($slidename)); //$new_name));
      imagedestroy($im_php);
      // unlink($new_name);
      if ($filterrework == '') {  $filterrework.=" setTimeout(function(){   window.parent.scrollTo(0,0); }, 20000); "; }
      if (('' . $lenv) == '0' || ('' . $lenv) == '1') {  $filterrework.=" if (parent.document.getElementById('i" . (-1 + $lenv) . "')) { parent.document.getElementById('i" . $lenv . "').src='" . $qpzm . "';  } ";  }
      $filterrework.=" parent.document.getElementById('i" . (-1 + $lenv) . "').src='" . $qpzm . "'; ";
      $sanum++;
      $saname=str_replace("arg0", "arg", "substancearg" . $sanum);
      $curnum++;
      if ($curnum >= $totnum) { $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist; return file_get_contents($slidename);  }  //$qpzm;
      $curlist=str_replace('edge','',$curlist);
      return new_content(file_get_contents($slidename));
    } else if (isset($_GET['sharpen']) || isset($_POST['sharpen']) && ($totlist == "" || strpos($curlist, 'sharpen') !== false)) {
      $im_php = imagecreatefromstring(ourfile_get_contents($zfilename));
      $sharpen = array([0, -1, 0], [-1, 5, -1], [0, -1, 0]);
      if (isset($_GET[$saname]) || isset($_POST[$saname])) {
      if (isset($_GET[$saname])) {
      if (evc(str_replace('+',' ',urldecode($_GET[$saname])), $im_php, $sharpen) == '') {
      imageconvolution($im_php, $sharpen, 1, 0);
      }
      } else if (isset($_POST[$saname])) {
      if (evc(str_replace('+',' ',urldecode($_POST[$saname])), $im_php, $sharpen) == '') {
      imageconvolution($im_php, $sharpen, 1, 0);
      }
      } else {
      imageconvolution($im_php, $sharpen, 1, 0);
      }
      } else {
      imageconvolution($im_php, $sharpen, 1, 0);
      }
      $new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      $mimet=imagewhat($im_php, $slidename); //, $new_name);
      $qpzm='data:image/' . $mimet . ';base64,' . base64_encode(ourfile_get_contents($slidename)); //$new_name));
      imagedestroy($im_php);
      // unlink($new_name);
      if ($filterrework == '') {  $filterrework.=" setTimeout(function(){   window.parent.scrollTo(0,0); }, 20000); "; }
      if (('' . $lenv) == '0' || ('' . $lenv) == '1') {  $filterrework.=" if (parent.document.getElementById('i" . (-1 + $lenv) . "')) { parent.document.getElementById('i" . $lenv . "').src='" . $qpzm . "';  } ";  }
      $filterrework.=" parent.document.getElementById('i" . (-1 + $lenv) . "').src='" . $qpzm . "'; ";
      $sanum++;
      $saname=str_replace("arg0", "arg", "substancearg" . $sanum);
      $curnum++;
      if ($curnum >= $totnum) { $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist; return file_get_contents($slidename);  }  //$qpzm;
      $curlist=str_replace('sharpen','',$curlist);
      return new_content(file_get_contents($slidename));
    } else if (isset($_GET['boxblur']) || isset($_POST['boxblur']) && ($totlist == "" || strpos($curlist, 'boxblur') !== false)) {
      $im_php = imagecreatefromstring(ourfile_get_contents($zfilename));
      $box_blur = array([1, 1, 1], [1, 1, 1], [1, 1, 1]);
      if (isset($_GET[$saname]) || isset($_POST[$saname])) {
      if (isset($_GET[$saname])) {
      if (evc(str_replace('+',' ',urldecode($_GET[$saname])), $im_php, $box_blur) == '') {
      imageconvolution($im_php, $box_blur, 9, 0); 
      }
      } else if (isset($_POST[$saname])) {
      if (evc(str_replace('+',' ',urldecode($_POST[$saname])), $im_php, $box_blur) == '') {
      imageconvolution($im_php, $box_blur, 9, 0); 
      }
      } else {
      imageconvolution($im_php, $box_blur, 9, 0); 
      }
      } else {
      imageconvolution($im_php, $box_blur, 9, 0);  
      }  
      $new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      $mimet=imagewhat($im_php, $slidename); //, $new_name);
      $qpzm='data:image/' . $mimet . ';base64,' . base64_encode(ourfile_get_contents($slidename)); //$new_name));
      imagedestroy($im_php);
      // unlink($new_name);
      if ($filterrework == '') {  $filterrework.=" setTimeout(function(){   window.parent.scrollTo(0,0); }, 20000); "; }
      if (('' . $lenv) == '0' || ('' . $lenv) == '1') {  $filterrework.=" if (parent.document.getElementById('i" . (-1 + $lenv) . "')) { parent.document.getElementById('i" . $lenv . "').src='" . $qpzm . "';  } ";  }
      $filterrework.=" parent.document.getElementById('i" . (-1 + $lenv) . "').src='" . $qpzm . "'; ";
      $sanum++;
      $saname=str_replace("arg0", "arg", "substancearg" . $sanum);
      $curnum++;
      if ($curnum >= $totnum) { $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist; return file_get_contents($slidename);  }  //$qpzm;
      $curlist=str_replace('boxblur','',$curlist);
      return new_content(file_get_contents($slidename));
    } else if (isset($_GET['negate']) || isset($_POST['negate']) && ($totlist == "" || strpos($curlist, 'negate') !== false)) {
      $im_php = imagecreatefromstring(ourfile_get_contents($zfilename));
      if (isset($_GET[$saname]) || isset($_POST[$saname])) {
      if (isset($_GET[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_GET[$saname])), $im_php, IMG_FILTER_NEGATE) == '') {
      imagefilter($im_php, IMG_FILTER_NEGATE);
      }
      } else if (isset($_POST[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_POST[$saname])), $im_php, IMG_FILTER_NEGATE) == '') {
      imagefilter($im_php, IMG_FILTER_NEGATE);
      }
      } else {
      imagefilter($im_php, IMG_FILTER_NEGATE);
      }
      } else {
      imagefilter($im_php, IMG_FILTER_NEGATE);
      }
      $new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      $mimet=imagewhat($im_php, $slidename); //, $new_name);
      $qpzm='data:image/' . $mimet . ';base64,' . base64_encode(ourfile_get_contents($slidename)); //$new_name));
      imagedestroy($im_php);
      // unlink($new_name);
      if ($filterrework == '') {  $filterrework.=" setTimeout(function(){   window.parent.scrollTo(0,0); }, 20000); "; }
      if (('' . $lenv) == '0' || ('' . $lenv) == '1') {  $filterrework.=" if (parent.document.getElementById('i" . (-1 + $lenv) . "')) { parent.document.getElementById('i" . $lenv . "').src='" . $qpzm . "';  } ";  }
      $filterrework.=" parent.document.getElementById('i" . (-1 + $lenv) . "').src='" . $qpzm . "'; ";
      $sanum++;
      $saname=str_replace("arg0", "arg", "substancearg" . $sanum);
      $curnum++;
      if ($curnum >= $totnum) { $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist; return file_get_contents($slidename);  }  //$qpzm;
      $curlist=str_replace('negate','',$curlist);
      return new_content(file_get_contents($slidename));
    } else if (isset($_GET['colourizered']) || isset($_POST['colourizered']) || isset($_GET['colorizered']) || isset($_POST['colorizered']) && ($totlist == "" || strpos($curlist, 'izered') !== false)) {
      $im_php = imagecreatefromstring(ourfile_get_contents($zfilename));
      if (isset($_GET[$saname]) || isset($_POST[$saname])) {
      if (isset($_GET[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_GET[$saname])), $im_php, IMG_FILTER_COLORIZE) == '') {
      imagefilter($im_php, IMG_FILTER_COLORIZE, 255, 0, 0);
      }
      } else if (isset($_POST[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_POST[$saname])), $im_php, IMG_FILTER_COLORIZE) == '') {
      imagefilter($im_php, IMG_FILTER_COLORIZE, 255, 0, 0);
      }
      } else {
      imagefilter($im_php, IMG_FILTER_COLORIZE, 255, 0, 0);
      }
      } else {
      imagefilter($im_php, IMG_FILTER_COLORIZE, 255, 0, 0); //, 100);
      }
      $new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      $mimet=imagewhat($im_php, $slidename); //, $new_name);
      $qpzm='data:image/' . $mimet . ';base64,' . base64_encode(ourfile_get_contents($slidename)); //$new_name));
      imagedestroy($im_php);
      // unlink($new_name);
      if ($filterrework == '') {  $filterrework.=" setTimeout(function(){   window.parent.scrollTo(0,0); }, 20000); "; }
      if (('' . $lenv) == '0' || ('' . $lenv) == '1') {  $filterrework.=" if (parent.document.getElementById('i" . (-1 + $lenv) . "')) { parent.document.getElementById('i" . $lenv . "').src='" . $qpzm . "';  } ";  }
      $filterrework.=" parent.document.getElementById('i" . (-1 + $lenv) . "').src='" . $qpzm . "'; ";
      $sanum++;
      $saname=str_replace("arg0", "arg", "substancearg" . $sanum);
      $curnum++;
      if ($curnum >= $totnum) { $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist; return file_get_contents($slidename);  }  //$qpzm;
      $curlist=str_replace('izered','',$curlist);
      return new_content(file_get_contents($slidename));
    } else if (isset($_GET['colourizeblue']) || isset($_POST['colourizeblue']) || isset($_GET['colorizeblue']) || isset($_POST['colorizeblue']) && ($totlist == "" || strpos($curlist, 'izeblue') !== false)) {
      $im_php = imagecreatefromstring(ourfile_get_contents($zfilename));
      if (isset($_GET[$saname]) || isset($_POST[$saname])) {
      if (isset($_GET[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_GET[$saname])), $im_php, IMG_FILTER_COLORIZE) == '') {
      imagefilter($im_php, IMG_FILTER_COLORIZE, 0, 0, 255);
      }
      } else if (isset($_POST[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_POST[$saname])), $im_php, IMG_FILTER_COLORIZE) == '') {
      imagefilter($im_php, IMG_FILTER_COLORIZE, 0, 0, 255);
      }
      } else {
      imagefilter($im_php, IMG_FILTER_COLORIZE, 0, 0, 255);
      }
      } else {
      imagefilter($im_php, IMG_FILTER_COLORIZE, 0, 0, 255); //, 100);
      }
      $new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      $mimet=imagewhat($im_php, $slidename); //, $new_name);
      $qpzm='data:image/' . $mimet . ';base64,' . base64_encode(ourfile_get_contents($slidename)); //$new_name));
      imagedestroy($im_php);
      // unlink($new_name);
      if ($filterrework == '') {  $filterrework.=" setTimeout(function(){   window.parent.scrollTo(0,0); }, 20000); "; }
      if (('' . $lenv) == '0' || ('' . $lenv) == '1') {  $filterrework.=" if (parent.document.getElementById('i" . (-1 + $lenv) . "')) { parent.document.getElementById('i" . $lenv . "').src='" . $qpzm . "';  } ";  }
      $filterrework.=" parent.document.getElementById('i" . (-1 + $lenv) . "').src='" . $qpzm . "'; ";
      $sanum++;
      $saname=str_replace("arg0", "arg", "substancearg" . $sanum);
      $curnum++;
      if ($curnum >= $totnum) { $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist; return file_get_contents($slidename);  }  //$qpzm;
      $curlist=str_replace('izeblue','',$curlist);
      return new_content(file_get_contents($slidename));
    } else if (isset($_GET['colourizegreen']) || isset($_POST['colourizegreen']) || isset($_GET['colorizegreen']) || isset($_POST['colorizegreen']) && ($totlist == "" || strpos($curlist, 'izegreen') !== false)) {
      $im_php = imagecreatefromstring(ourfile_get_contents($zfilename));
      if (isset($_GET[$saname]) || isset($_POST[$saname])) {
      if (isset($_GET[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_GET[$saname])), $im_php, IMG_FILTER_COLORIZE) == '') {
      imagefilter($im_php, IMG_FILTER_COLORIZE, 0, 255, 0);
      }
      } else if (isset($_POST[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_POST[$saname])), $im_php, IMG_FILTER_COLORIZE) == '') {
      imagefilter($im_php, IMG_FILTER_COLORIZE, 0, 255, 0);
      }
      } else {
      imagefilter($im_php, IMG_FILTER_COLORIZE, 0, 255, 0);
      }
      } else {
      imagefilter($im_php, IMG_FILTER_COLORIZE, 0, 255, 0); //, 100);
      }
      $new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      $mimet=imagewhat($im_php, $slidename); //, $new_name);
      $qpzm='data:image/' . $mimet . ';base64,' . base64_encode(ourfile_get_contents($slidename)); //$new_name));
      imagedestroy($im_php);
      // unlink($new_name);
      if ($filterrework == '') {  $filterrework.=" setTimeout(function(){   window.parent.scrollTo(0,0); }, 20000); "; }
      if (('' . $lenv) == '0' || ('' . $lenv) == '1') {  $filterrework.=" if (parent.document.getElementById('i" . (-1 + $lenv) . "')) { parent.document.getElementById('i" . $lenv . "').src='" . $qpzm . "';  } ";  }
      $filterrework.=" parent.document.getElementById('i" . (-1 + $lenv) . "').src='" . $qpzm . "'; ";
      $sanum++;
      $saname=str_replace("arg0", "arg", "substancearg" . $sanum);
      $curnum++;
      if ($curnum >= $totnum) { $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist; return file_get_contents($slidename);  }  //$qpzm;
      $curlist=str_replace('izegreen','',$curlist);
      return new_content(file_get_contents($slidename));
    } else if (isset($_GET['colourize']) || isset($_POST['colourize']) || isset($_GET['colorize']) || isset($_POST['colorize']) && ($totlist == "" || strpos($curlist, 'rize') !== false)) {
      $im_php = imagecreatefromstring(ourfile_get_contents($zfilename));
      if (isset($_GET[$saname]) || isset($_POST[$saname])) {
      if (isset($_GET[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_GET[$saname])), $im_php, IMG_FILTER_COLORIZE) == '') {
      imagefilter($im_php, IMG_FILTER_COLORIZE, -127.12, -127.98, 127);
      }
      } else if (isset($_POST[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_POST[$saname])), $im_php, IMG_FILTER_COLORIZE) == '') {
      imagefilter($im_php, IMG_FILTER_COLORIZE, -127.12, -127.98, 127);
      }
      } else {
      imagefilter($im_php, IMG_FILTER_COLORIZE, -127.12, -127.98, 127);
      }
      } else {
      imagefilter($im_php, IMG_FILTER_COLORIZE, -127.12, -127.98, 127); //, 100);
      }
      $new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      $mimet=imagewhat($im_php, $slidename); //, $new_name);
      $qpzm='data:image/' . $mimet . ';base64,' . base64_encode(ourfile_get_contents($slidename)); //$new_name));
      imagedestroy($im_php);
      // unlink($new_name);
      if ($filterrework == '') {  $filterrework.=" setTimeout(function(){   window.parent.scrollTo(0,0); }, 20000); "; }
      if (('' . $lenv) == '0' || ('' . $lenv) == '1') {  $filterrework.=" if (parent.document.getElementById('i" . (-1 + $lenv) . "')) { parent.document.getElementById('i" . $lenv . "').src='" . $qpzm . "';  } ";  }
      $filterrework.=" parent.document.getElementById('i" . (-1 + $lenv) . "').src='" . $qpzm . "'; ";
      $sanum++;
      $saname=str_replace("arg0", "arg", "substancearg" . $sanum);
      $curnum++;
      if ($curnum >= $totnum) { $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist; return file_get_contents($slidename);  }  //$qpzm;
      $curlist=str_replace('rize','',$curlist);
      return new_content(file_get_contents($slidename));
    } else if (isset($_GET['pixellate']) || isset($_POST['pixellate']) || isset($_GET['pixelate']) || isset($_POST['pixelate']) && ($totlist == "" || strpos($curlist, 'pixellate') !== false))  {
      $im_php = imagecreatefromstring(ourfile_get_contents($zfilename));
      if (isset($_GET[$saname]) || isset($_POST[$saname])) {
      if (isset($_GET[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_GET[$saname])), $im_php, IMG_FILTER_PIXELATE) == '') {
      imagefilter($im_php, IMG_FILTER_PIXELATE, 3);
      }
      } else if (isset($_POST[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_POST[$saname])), $im_php, IMG_FILTER_PIXELATE) == '') {
      imagefilter($im_php, IMG_FILTER_PIXELATE, 3);
      }
      } else {
      imagefilter($im_php, IMG_FILTER_PIXELATE, 3);
      }
      } else {
      imagefilter($im_php, IMG_FILTER_PIXELATE, 3);
      }
      $new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      $mimet=imagewhat($im_php, $slidename); //, $new_name);
      $qpzm='data:image/' . $mimet . ';base64,' . base64_encode(ourfile_get_contents($slidename)); //$new_name));
      imagedestroy($im_php);
      // unlink($new_name);
      if ($filterrework == '') {  $filterrework.=" setTimeout(function(){   window.parent.scrollTo(0,0); }, 20000); "; }
      if (('' . $lenv) == '0' || ('' . $lenv) == '1') {  $filterrework.=" if (parent.document.getElementById('i" . (-1 + $lenv) . "')) { parent.document.getElementById('i" . $lenv . "').src='" . $qpzm . "';  } ";  }
      $filterrework.=" parent.document.getElementById('i" . (-1 + $lenv) . "').src='" . $qpzm . "'; ";
      $sanum++;
      $saname=str_replace("arg0", "arg", "substancearg" . $sanum);
      $curnum++;
      if ($curnum >= $totnum) { $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist; return file_get_contents($slidename);  }  //$qpzm;
      $curlist=str_replace('pixellate','',$curlist);
      return new_content(file_get_contents($slidename));
    } else if (isset($_GET['smooth']) || isset($_POST['smooth']) && ($totlist == "" || strpos($curlist, 'smooth') !== false)) {
      $im_php = imagecreatefromstring(ourfile_get_contents($zfilename));
      if (isset($_GET[$saname]) || isset($_POST[$saname])) {
      if (isset($_GET[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_GET[$saname])), $im_php, IMG_FILTER_SMOOTH) == '') {
      imagefilter($im_php, IMG_FILTER_SMOOTH, -1924.124);
      }
      } else if (isset($_POST[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_POST[$saname])), $im_php, IMG_FILTER_SMOOTH) == '') {
      imagefilter($im_php, IMG_FILTER_SMOOTH, -1924.124);
      }
      } else {
      imagefilter($im_php, IMG_FILTER_SMOOTH, -1924.124);
      }
      } else {      
      imagefilter($im_php, IMG_FILTER_SMOOTH, -1924.124);
      }
      $new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      $mimet=imagewhat($im_php, $slidename); //, $new_name);
      $qpzm='data:image/' . $mimet . ';base64,' . base64_encode(ourfile_get_contents($slidename)); //$new_name));
      imagedestroy($im_php);
      // unlink($new_name);
      if ($filterrework == '') {  $filterrework.=" setTimeout(function(){   window.parent.scrollTo(0,0); }, 20000); "; }
      if (('' . $lenv) == '0' || ('' . $lenv) == '1') {  $filterrework.=" if (parent.document.getElementById('i" . (-1 + $lenv) . "')) { parent.document.getElementById('i" . $lenv . "').src='" . $qpzm . "';  } ";  }
      $filterrework.=" parent.document.getElementById('i" . (-1 + $lenv) . "').src='" . $qpzm . "'; ";
      $sanum++;
      $saname=str_replace("arg0", "arg", "substancearg" . $sanum);
      $curnum++;
      if ($curnum >= $totnum) { $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist; return file_get_contents($slidename);  }  //$qpzm;
      $curlist=str_replace('smooth','',$curlist);
      return new_content(file_get_contents($slidename));
    } else if (isset($_GET['contrast']) || isset($_POST['contrast']) && ($totlist == "" || strpos($curlist, 'contrast') !== false)) {
      $im_php = imagecreatefromstring(ourfile_get_contents($zfilename));
      if (isset($_GET[$saname]) || isset($_POST[$saname])) {
      if (isset($_GET[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_GET[$saname])), $im_php,  IMG_FILTER_CONTRAST) == '') {
      imagefilter($im_php,  IMG_FILTER_CONTRAST, -90);
      }
      } else if (isset($_POST[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_POST[$saname])), $im_php,  IMG_FILTER_CONTRAST) == '') {
      imagefilter($im_php,  IMG_FILTER_CONTRAST, -90);
      }
      } else {
      imagefilter($im_php,  IMG_FILTER_CONTRAST, -90);
      }
      } else {      
      imagefilter($im_php, IMG_FILTER_CONTRAST, -90);
      }
      $new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      $mimet=imagewhat($im_php, $slidename); //, $new_name);
      $qpzm='data:image/' . $mimet . ';base64,' . base64_encode(ourfile_get_contents($slidename)); //$new_name));
      imagedestroy($im_php);
      // unlink($new_name);
      if ($filterrework == '') {  $filterrework.=" setTimeout(function(){   window.parent.scrollTo(0,0); }, 20000); "; }
      if (('' . $lenv) == '0' || ('' . $lenv) == '1') {  $filterrework.=" if (parent.document.getElementById('i" . (-1 + $lenv) . "')) { parent.document.getElementById('i" . $lenv . "').src='" . $qpzm . "';  } ";  }
      $filterrework.=" parent.document.getElementById('i" . (-1 + $lenv) . "').src='" . $qpzm . "'; ";
      $sanum++;
      $saname=str_replace("arg0", "arg", "substancearg" . $sanum);
      $curnum++;
      if ($curnum >= $totnum) { $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist; return file_get_contents($slidename);  }  //$qpzm;
      $curlist=str_replace('contrast','',$curlist);
      return new_content(file_get_contents($slidename));
    } else if (isset($_GET['brightness']) || isset($_POST['brightness']) && ($totlist == "" || strpos($curlist, 'brightness') !== false)) {
      $im_php = imagecreatefromstring(ourfile_get_contents($zfilename));
      if (isset($_GET[$saname]) || isset($_POST[$saname])) {
      if (isset($_GET[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_GET[$saname])), $im_php,  IMG_FILTER_BRIGHTNESS) == '') {
      imagefilter($im_php,  IMG_FILTER_BRIGHTNESS, 98);
      }
      } else if (isset($_POST[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_POST[$saname])), $im_php,  IMG_FILTER_BRIGHTNESS) == '') {
      imagefilter($im_php,  IMG_FILTER_BRIGHTNESS, 98);
      }
      } else {
      imagefilter($im_php,  IMG_FILTER_BRIGHTNESS, 98);
      }
      } else {      
      imagefilter($im_php, IMG_FILTER_BRIGHTNESS, 98);
      }
      $new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      $mimet=imagewhat($im_php, $slidename); //, $new_name);
      $qpzm='data:image/' . $mimet . ';base64,' . base64_encode(ourfile_get_contents($slidename)); //$new_name));
      imagedestroy($im_php);
      // unlink($new_name);
      if ($filterrework == '') {  $filterrework.=" setTimeout(function(){   window.parent.scrollTo(0,0); }, 20000); "; }
      if (('' . $lenv) == '0' || ('' . $lenv) == '1') {  $filterrework.=" if (parent.document.getElementById('i" . (-1 + $lenv) . "')) { parent.document.getElementById('i" . $lenv . "').src='" . $qpzm . "';  } ";  }
      $filterrework.=" parent.document.getElementById('i" . (-1 + $lenv) . "').src='" . $qpzm . "'; ";
      $sanum++;
      $saname=str_replace("arg0", "arg", "substancearg" . $sanum);
      $curnum++;
      if ($curnum >= $totnum) { $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist; return file_get_contents($slidename);  }  //$qpzm;
      $curlist=str_replace('brightness','',$curlist);
      return new_content(file_get_contents($slidename));
    } else if (isset($_GET['sketchy']) || isset($_POST['sketchy']) || isset($_GET['mean_removal']) || isset($_POST['mean_removal']) || isset($_GET['mean-removal']) || isset($_POST['mean-removal']) && ($totlist == "" || strpos(str_replace('mean_removal','sketchy',$curlist), 'sketchy') !== false))  {
      $im_php = imagecreatefromstring(ourfile_get_contents($zfilename));
      if (isset($_GET[$saname]) || isset($_POST[$saname])) {
      if (isset($_GET[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_GET[$saname])), $im_php,  IMG_FILTER_MEAN_REMOVAL) == '') {
      imagefilter($im_php,  IMG_FILTER_MEAN_REMOVAL);
      }
      } else if (isset($_POST[$saname])) {
      if (evl(str_replace('+',' ',urldecode($_POST[$saname])), $im_php,  IMG_FILTER_MEAN_REMOVAL) == '') {
      imagefilter($im_php,  IMG_FILTER_MEAN_REMOVAL);
      }
      } else {
      imagefilter($im_php,  IMG_FILTER_MEAN_REMOVAL);
      }
      } else {      
      imagefilter($im_php, IMG_FILTER_MEAN_REMOVAL);
      }
      $new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      $mimet=imagewhat($im_php, $slidename); //, $new_name);
      $qpzm='data:image/' . $mimet . ';base64,' . base64_encode(ourfile_get_contents($slidename)); //$new_name));
      imagedestroy($im_php);
      // unlink($new_name);
      if ($filterrework == '') {  $filterrework.=" setTimeout(function(){   window.parent.scrollTo(0,0); }, 20000); "; }
      if (('' . $lenv) == '0' || ('' . $lenv) == '1') {  $filterrework.=" if (parent.document.getElementById('i" . (-1 + $lenv) . "')) { parent.document.getElementById('i" . $lenv . "').src='" . $qpzm . "';  } ";  }
      $filterrework.=" parent.document.getElementById('i" . (-1 + $lenv) . "').src='" . $qpzm . "'; ";
      $sanum++;
      $saname=str_replace("arg0", "arg", "substancearg" . $sanum);
      $curnum++;
      if ($curnum >= $totnum) { $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist; return file_get_contents($slidename);  }  //$qpzm;
      $curlist=str_replace('sketchy','',str_replace('mean_removal','',$curlist));
      return new_content(file_get_contents($slidename));
    } else if (isset($_GET['flipvertical']) || isset($_POST['flipvertical']) && ($totlist == "" || strpos($curlist, 'flipvertical') !== false)) {
      $im_php = imagecreatefromstring(ourfile_get_contents($zfilename));
      imageflip($im_php, IMG_FLIP_VERTICAL);
      $new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      $mimet=imagewhat($im_php, $slidename); //, $new_name);
      $qpzm='data:image/' . $mimet . ';base64,' . base64_encode(ourfile_get_contents($slidename)); //$new_name));
      imagedestroy($im_php);
      // unlink($new_name);
      if ($filterrework == '') {  $filterrework.=" setTimeout(function(){   window.parent.scrollTo(0,0); }, 20000); "; }
      if (('' . $lenv) == '0' || ('' . $lenv) == '1') {  $filterrework.=" if (parent.document.getElementById('i" . (-1 + $lenv) . "')) { parent.document.getElementById('i" . $lenv . "').src='" . $qpzm . "';  } ";  }
      $filterrework.=" parent.document.getElementById('i" . (-1 + $lenv) . "').src='" . $qpzm . "'; ";
      $sanum++;
      $saname=str_replace("arg0", "arg", "substancearg" . $sanum);
      $curnum++;
      if ($curnum >= $totnum) { $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist; return file_get_contents($slidename);  }  //$qpzm;
      $curlist=str_replace('flipvertical','',$curlist);
      return new_content(file_get_contents($slidename));
    } else if (isset($_GET['fliphorizontal']) || isset($_POST['fliphorizontal']) && ($totlist == "" || strpos($curlist, 'fliphorizontal') !== false)) {
      $im_php = imagecreatefromstring(ourfile_get_contents($zfilename));
      imageflip($im_php, IMG_FLIP_HORIZONTAL);
      $new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      $mimet=imagewhat($im_php, $slidename); //, $new_name);
      $qpzm='data:image/' . $mimet . ';base64,' . base64_encode(ourfile_get_contents($slidename)); //$new_name));
      imagedestroy($im_php);
      // unlink($new_name);
      if ($filterrework == '') {  $filterrework.=" setTimeout(function(){   window.parent.scrollTo(0,0); }, 20000); "; }
      if (('' . $lenv) == '0' || ('' . $lenv) == '1') {  $filterrework.=" if (parent.document.getElementById('i" . (-1 + $lenv) . "')) { parent.document.getElementById('i" . $lenv . "').src='" . $qpzm . "';  } ";  }
      $filterrework.=" parent.document.getElementById('i" . (-1 + $lenv) . "').src='" . $qpzm . "'; ";
      $sanum++;
      $saname=str_replace("arg0", "arg", "substancearg" . $sanum);
      $curnum++;
      if ($curnum >= $totnum) { $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist; return file_get_contents($slidename);  }  //$qpzm;
      $curlist=str_replace('fliphorizontal','',$curlist);
      return new_content(file_get_contents($slidename));
    } else if (isset($_GET['flip']) || isset($_POST['flip']) && ($totlist == "" || strpos($curlist, 'flip') !== false)) {
      $im_php = imagecreatefromstring(ourfile_get_contents($zfilename));
      imageflip($im_php, IMG_FLIP_BOTH);
      $new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      $mimet=imagewhat($im_php, $slidename); //, $new_name);
      $qpzm='data:image/' . $mimet . ';base64,' . base64_encode(ourfile_get_contents($slidename)); //$new_name));
      imagedestroy($im_php);
      // unlink($new_name);
      if ($filterrework == '') {  $filterrework.=" setTimeout(function(){   window.parent.scrollTo(0,0); }, 20000); "; }
      if (('' . $lenv) == '0' || ('' . $lenv) == '1') {  $filterrework.=" if (parent.document.getElementById('i" . (-1 + $lenv) . "')) { parent.document.getElementById('i" . $lenv . "').src='" . $qpzm . "';  } ";  }
      $filterrework.=" parent.document.getElementById('i" . (-1 + $lenv) . "').src='" . $qpzm . "'; ";
      $sanum++;
      $saname=str_replace("arg0", "arg", "substancearg" . $sanum);
      $curnum++;
      if ($curnum >= $totnum) { $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist; return file_get_contents($slidename);  }  //$qpzm;
      $curlist=str_replace('flip','',$curlist);
      return new_content(file_get_contents($slidename));
    }
    return $zfilename;
 }
 
function server_remote_addr() {
    global $stfle;
    $rma = $_SERVER['REMOTE_ADDR'];
    $ua = strtolower((isset($_SERVER['HTTP_USER_AGENT']) ? $_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);
}


   if (isset($_POST['vlist']) && isset($_POST['vandagimg1'])) {
     $iex='';
     $jex='';
     $lenv='1';
     $iext='jpg';
     $theeyes='';
     $midsw=' -c:v libx264 -pix_fmt yuv420p -profile:v main -level:v 3.1 -an ';
     foreach (glob('/tmp/imagerequestwp_' . server_remote_addr() . '-*.*') as $medfil) {
       unlink($medfil);
     }
     if (strpos(('~' . $_POST['vandagimg' . (0 + $lenv)]), '~data') !== false) {
        $cont=str_replace(' ','+',urldecode($_POST['vandagimg' . (0 + $lenv)]));
        $slidename='/tmp/imagerequestwp_' . server_remote_addr() . '-' . substr(('000' . $lenv),-3,3) . '.' . explode(';', explode('image/', $cont)[1])[0];
        file_put_contents($slidename, base64_decode(explode(';base64,',$cont)[1]));
        $theeyes.=testgif(' -framerate ' . $fps . ' -i ' . $slidename . ' ');
     } else if (strpos(urldecode($_POST['vandagimg' . (0 + $lenv)]), 'rjmprogramming.com.au/') !== false) {
        if (isset($_POST['fromindex'])) {
        $iex=explode('.', urldecode($_POST['vandagimg' . (0 + $lenv)]))[-1 + sizeof(explode('.', urldecode($_POST['vandagimg' . (0 + $lenv)])))];
        if ($jex == '') {
 //file_put_contents('aa.vvv', 'iex=' . $iex . ' jex=' . $jex);
          $jex=$iex;
        } else if ($iex != $jex && trim($jex) != '') {
 //file_put_contents('aa.vv', 'iex=' . $iex . ' jex=' . $jex);
          $jex=' ';
        }
        $cont=file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . explode('rjmprogramming.com.au/', str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)])))[1]);
        $slidename='/tmp/imagerequestwp_' . server_remote_addr() . '-' . substr(('000' . $lenv),-3,3) . '.' . str_replace('jpg','jpeg',$iex);
        $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist;
        file_put_contents($slidename, new_content($cont));
        $theeyes.=testgif(' -framerate ' . $fps . ' -i ' . $slidename . ' ');
        } else {
        $theeyes.=testgif(' -framerate ' . $fps . ' -i ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . explode('rjmprogramming.com.au/', str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)])))[1]  . ' ');
        }
     } else if (strpos(urldecode($_POST['vandagimg' . (0 + $lenv)]), '//') !== false) {
        $cont=file_get_contents('http://' . explode('//', str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)])))[1]);
        $slidename='/tmp/imagerequestwp_' . server_remote_addr() . '-' . substr(('000' . $lenv),-3,3) . '.' . explode('.', str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)])))[-1 + sizeof(explode('.', str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)]))))];
        file_put_contents($slidename, base64_decode(explode(';base64,',$cont)[1]));
        $theeyes.=testgif(' -framerate ' . $fps . ' -i ' . $slidename . ' ');
     } else {  
        $theeyes.=testgif(' -framerate ' . $fps . ' -i ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)]))  . ' ');
     }
     while (isset($_POST['vandagimg' . (1 + $lenv)])) {
       $lenv='' . (1 + $lenv);
     if (strpos(('~' . $_POST['vandagimg' . (0 + $lenv)]), '~data') !== false) {
        $cont=str_replace(' ','+',urldecode($_POST['vandagimg' . (0 + $lenv)]));
        $slidename='/tmp/imagerequestwp_' . server_remote_addr() . '-' . substr(('000' . $lenv),-3,3) . '.' . explode(';', explode('image/', $cont)[1])[0];
        file_put_contents($slidename, base64_decode(explode(';base64,',$cont)[1]));
        $theeyes.=testgif(' -framerate 2 -i ' . $slidename . ' ');
     } else if (strpos(urldecode($_POST['vandagimg' . (0 + $lenv)]), 'rjmprogramming.com.au/') !== false) {
        if (isset($_POST['fromindex'])) {
        $iex=explode('.', urldecode($_POST['vandagimg' . (0 + $lenv)]))[-1 + sizeof(explode('.', urldecode($_POST['vandagimg' . (0 + $lenv)])))];
        if ($jex == '') {
 //file_put_contents('aa.www', 'iex=' . $iex . ' jex=' . $jex);
          $jex=$iex;
        } else if ($iex != $jex && trim($jex) != '') {
 //file_put_contents('aa.ww', 'iex=' . $iex . ' jex=' . $jex);
          $jex=' ';
        }
        $cont=file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . explode('rjmprogramming.com.au/', str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)])))[1]);
        $slidename='/tmp/imagerequestwp_' . server_remote_addr() . '-' . substr(('000' . $lenv),-3,3) . '.' . str_replace('jpg','jpeg',$iex);
        $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist;
        file_put_contents($slidename, new_content($cont));
        $theeyes.=testgif(' -framerate 2 -i ' . $slidename . ' ');
        } else {
        $theeyes.=testgif(' -framerate 2 -i ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . explode('rjmprogramming.com.au/', str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)])))[1]  . ' ');
        }
     } else if (strpos(urldecode($_POST['vandagimg' . (0 + $lenv)]), '//') !== false) {
        $cont=file_get_contents('http://' . explode('//', str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)])))[1]);
        $slidename='/tmp/imagerequestwp_' . server_remote_addr() . '-' . substr(('000' . $lenv),-3,3) . '.' . explode('.', str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)])))[-1 + sizeof(explode('.', str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)]))))];
        file_put_contents($slidename, base64_decode(explode(';base64,',$cont)[1]));
        $theeyes.=testgif(' -framerate 2 -i ' . $slidename . ' ');
     } else {  
        $theeyes.=testgif(' -framerate 2 -i ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)]))  . ' ');
     }
     }
     
     if (isset($_POST['fromindex']) && trim($jex) != '' &&  str_replace('jpg','jpeg',$jex) != 'gif') {
       $theeyes=' -framerate 2 -i ' . '/tmp/imagerequestwp_' . server_remote_addr() . '-%03d.' . str_replace('jpg','jpeg',$jex) . ' ';
     } else if (isset($_POST['fromindex']) && trim($jex) != '' &&  str_replace('jpg','jpeg',$jex) == 'gif') {
       $theeyes=' -i ' . '/tmp/imagerequestwp_' . server_remote_addr() . '-%03d.' . str_replace('jpg','jpeg',$jex) . ' ';
     }
     
     if (file_exists('/tmp/videowp' . server_remote_addr() . '.mp4')) {
       exec('rm -f /tmp/videowp' . server_remote_addr() . '.mp4');
     }
     //exec('ffmpeg ' . $theeyes . ' -vcodec libx264 -crf 22 /tmp/videowp' . server_remote_addr() . '.mp4');
 //file_put_contents('aa.yy', 'ffmpeg ' . $theeyes . ' -c:v libx264 -pix_fmt yuv420p -profile:v main -level:v 3.1 -an /tmp/videowp' . server_remote_addr() . '.mp4');
     exec('ffmpeg ' . $theeyes . ' ' . $midsw . ' /tmp/videowp' . server_remote_addr() . '.mp4'); 
     if (!file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'videowp' . server_remote_addr() . '.mp4')) {
 //file_put_contents('aa.zz', $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'videowp' . server_remote_addr() . '.mp4');
       exec('ln -s /tmp/videowp' . server_remote_addr() . '.mp4 ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'videowp' . server_remote_addr() . '.mp4');
 //file_put_contents('bb.zz', $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'videowp' . server_remote_addr() . '.mp4');
     }
     if (file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'videowp' . server_remote_addr() . '.mp4')) {
 //file_put_contents('cc.zz', $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'videowp' . server_remote_addr() . '.mp4');
     echo "<html><body onload=\" if (parent.document.getElementById('slide' + 'showdiv')) { parent.document.getElementById('slideshowdiv').style.height='1980px'; }  if (parent.document.getElementById('divcowpf')) { if (parent.document.getElementById('mysource')) { parent.document.getElementById('mysource').src='/videowp" . server_remote_addr() . '.mp4?rand=' . rand(0,675434) . "'; } else {  parent.document.getElementById('divcowpf').innerHTML+='<a style=display:inline-block; href=#myh1 title=Top>&#128285;</a><details style=display:inline-block; open><summary>Video version below (and double click it for popup view) ...</summary><video ondblclick=ondblc(this); id=myvideo controls><source id=mysource type=video/mp4 src=/videowp" . server_remote_addr() . ".mp4?rand=" . rand(0,675434) . "></source></video>" . str_replace("'", "' + String.fromCharCode(39) + '", str_replace('</head>','',str_replace('<head>','',$headscript))) . "</details>'; } } " . $filterrework . " \"></body></html>";
     } else {
 //file_put_contents('dd.zz', $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'videowp' . server_remote_addr() . '.mp4');
     echo "<html><body onload=\" if (parent.document.getElementById('slide' + 'showdiv')) { parent.document.getElementById('slideshowdiv').style.height='1980px'; }  if (parent.document.getElementById('divcowpf')) { if (parent.document.getElementById('mysource')) { parent.document.getElementById('mysource').src='data:video/mp4;base64," . base64_encode(file_get_contents('/tmp/videowp' . server_remote_addr() . '.mp4')) . "'; } else {  parent.document.getElementById('divcowpf').innerHTML+='<a style=display:inline-block; href=#myh1 title=Top>&#128285;</a><details style=display:inline-block; open><summary>Video version below (and double click it for popup view) ...</summary><video ondblclick=ondblc(this); id=myvideo controls><source id=mysource type=video/mp4 src=' + String.fromCharCode(39) + 'data:video/mp4;base64," . base64_encode(file_get_contents('/tmp/videowp' . server_remote_addr() . '.mp4')) . "' + String.fromCharCode(39) + '></source></video>" . str_replace("'", "' + String.fromCharCode(39) + '", str_replace('</head>','',str_replace('<head>','',$headscript))) . "</details>'; } } " . $filterrework . " \"></body></html>";
     }
     exit;
   } else if (isset($_POST['aglist']) && isset($_POST['vandagimg1'])) {
//file_put_contents('/tmp/ag0.0', 'y');
     $iex='';
     $jex='';
     $lenv='1';
     $iext='jpg';
     $theeyes='';
     foreach (glob('/tmp/imagerequestwp_' . server_remote_addr() . '-*.*') as $medfil) {
       unlink($medfil);
     }
//file_put_contents('/tmp/ag0.1', 'y');
     if (strpos(('~' . $_POST['vandagimg' . (0 + $lenv)]), '~data') !== false) {
        $cont=str_replace(' ','+',urldecode($_POST['vandagimg' . (0 + $lenv)]));
        $slidename='/tmp/imagerequestwp_' . server_remote_addr() . '-' . substr(('000' . $lenv),-3,3) . '.' . explode(';', explode('image/', $cont)[1])[0];
        file_put_contents($slidename, base64_decode(explode(';base64,',$cont)[1]));
        $theeyes.=testgif(' -framerate 2 -i ' . $slidename . ' ');
     } else if (strpos(urldecode($_POST['vandagimg' . (0 + $lenv)]), 'rjmprogramming.com.au/') !== false) {
        if (isset($_POST['fromindex'])) {
        $iex=explode('.', urldecode($_POST['vandagimg' . (0 + $lenv)]))[-1 + sizeof(explode('.', urldecode($_POST['vandagimg' . (0 + $lenv)])))];
        if ($jex == '') {
 //file_put_contents('aa.vvv', 'iex=' . $iex . ' jex=' . $jex);
          $jex=$iex;
        } else if ($iex != $jex && trim($jex) != '') {
 //file_put_contents('aa.vv', 'iex=' . $iex . ' jex=' . $jex);
          $jex=' ';
        }
        $cont=file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . explode('rjmprogramming.com.au/', str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)])))[1]);
        $slidename='/tmp/imagerequestwp_' . server_remote_addr() . '-' . substr(('000' . $lenv),-3,3) . '.' . str_replace('jpg','jpeg',$iex);
        $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist;
        file_put_contents($slidename, new_content($cont));
        $theeyes.=testgif(' -framerate 2 -i ' . $slidename . ' ');
        } else {
        $theeyes.=testgif(' -framerate 2 -i ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . explode('rjmprogramming.com.au/', str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)])))[1]  . ' ');
        }
     } else if (strpos(urldecode($_POST['vandagimg' . (0 + $lenv)]), '//') !== false) {
        $cont=file_get_contents('http://' . explode('//', str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)])))[1]);
        $slidename='/tmp/imagerequestwp_' . server_remote_addr() . '-' . substr(('000' . $lenv),-3,3) . '.' . explode('.', str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)])))[-1 + sizeof(explode('.', str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)]))))];
        file_put_contents($slidename, base64_decode(explode(';base64,',$cont)[1]));
        $theeyes.=testgif(' -framerate 2 -i ' . $slidename . ' ');
     } else {  
        $theeyes.=testgif(' -framerate 2 -i ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)]))  . ' ');
     }
//file_put_contents('/tmp/ag0.2', 'y');
     while (isset($_POST['vandagimg' . (1 + $lenv)])) {
       $lenv='' . (1 + $lenv);
//file_put_contents('/tmp/ag' . $lenv . '.3', 'y');
     if (strpos(('~' . $_POST['vandagimg' . (0 + $lenv)]), '~data') !== false) {
        $cont=str_replace(' ','+',urldecode($_POST['vandagimg' . (0 + $lenv)]));
        $slidename='/tmp/imagerequestwp_' . server_remote_addr() . '-' . substr(('000' . $lenv),-3,3) . '.' . explode(';', explode('image/', $cont)[1])[0];
        file_put_contents($slidename, base64_decode(explode(';base64,',$cont)[1]));
        $theeyes.=testgif(' -framerate 2 -i ' . $slidename . ' ');
     } else if (strpos(urldecode($_POST['vandagimg' . (0 + $lenv)]), 'rjmprogramming.com.au/') !== false) {
        if (isset($_POST['fromindex'])) {
        $iex=explode('.', urldecode($_POST['vandagimg' . (0 + $lenv)]))[-1 + sizeof(explode('.', urldecode($_POST['vandagimg' . (0 + $lenv)])))];
        if ($jex == '') {
 //file_put_contents('aa.vvv', 'iex=' . $iex . ' jex=' . $jex);
          $jex=$iex;
        } else if ($iex != $jex && trim($jex) != '') {
 //file_put_contents('aa.vv', 'iex=' . $iex . ' jex=' . $jex);
          $jex=' ';
        }
        $cont=file_get_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . explode('rjmprogramming.com.au/', str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)])))[1]);
        $slidename='/tmp/imagerequestwp_' . server_remote_addr() . '-' . substr(('000' . $lenv),-3,3) . '.' . str_replace('jpg','jpeg',$iex);
        $sanum=0;  $curnum=0; $saname=str_replace("arg0", "arg", "substancearg" . $sanum); $curlist=$totlist;
        file_put_contents($slidename, new_content($cont));
        $theeyes.=testgif(' -framerate 2 -i ' . $slidename . ' ');
        } else {
        $theeyes.=testgif(' -framerate 2 -i ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . explode('rjmprogramming.com.au/', str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)])))[1]  . ' ');
        }
     } else if (strpos(urldecode($_POST['vandagimg' . (0 + $lenv)]), '//') !== false) {
        $cont=file_get_contents('http://' . explode('//', str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)])))[1]);
        $slidename='/tmp/imagerequestwp_' . server_remote_addr() . '-' . substr(('000' . $lenv),-3,3) . '.' . explode('.', str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)])))[-1 + sizeof(explode('.', str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)]))))];
        file_put_contents($slidename, base64_decode(explode(';base64,',$cont)[1]));
        $theeyes.=testgif(' -framerate 2 -i ' . $slidename . ' ');
     } else {  
        $theeyes.=testgif(' -framerate 2 -i ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . str_replace('+',' ',urldecode($_POST['vandagimg' . (0 + $lenv)]))  . ' ');
     }
     }
//file_put_contents('/tmp/ag0.4', 'y');
     if (file_exists('/tmp/agifwp' . server_remote_addr() . '.gif')) {
       exec('rm -f /tmp/agifwp' . server_remote_addr() . '.gif');
     }
     
     if (isset($_POST['fromindex']) && trim($jex) != '' &&  str_replace('jpg','jpeg',$jex) != 'gif') {
       $theeyes=' -framerate 2 -i ' . '/tmp/imagerequestwp_' . server_remote_addr() . '-%03d.' . str_replace('jpg','jpeg',$jex) . ' ';
     } else if (isset($_POST['fromindex']) && trim($jex) != '' &&  str_replace('jpg','jpeg',$jex) == 'gif') {
       $theeyes=' -i ' . '/tmp/imagerequestwp_' . server_remote_addr() . '-%03d.' . str_replace('jpg','jpeg',$jex) . ' ';
     }
     
//file_put_contents('/tmp/ag0.5', 'y');
     if (!file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'agifwp' . server_remote_addr() . '.gif')) {
       exec('ln -s /tmp/agifwp' . server_remote_addr() . '.gif ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'agifwp' . server_remote_addr() . '.gif');
     }

     file_put_contents('/tmp/agok.ok', 'ffmpeg ' . $theeyes . ' /tmp/agifwp' . server_remote_addr() . '.gif 2> /tmp/agbad.bad');
     exec('ffmpeg ' . $theeyes . ' /tmp/agifwp' . server_remote_addr() . '.gif 2> /tmp/agbad.bad');
     if (file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'agifwp' . server_remote_addr() . '.gif')) {
     echo "<html><body onload=\" if (parent.document.getElementById('slide' + 'showdiv')) { parent.document.getElementById('slideshowdiv').style.height='1980px'; }  if (parent.document.getElementById('divcowpf')) { if (parent.document.getElementById('mygif')) { parent.document.getElementById('mygif').src='/agifwp" . server_remote_addr() . '.gif?rand=' . rand(0,675434) . "'; } else {  parent.document.getElementById('divcowpf').innerHTML+='<br><a style=display:inline-block;vertical-align:top; href=#myh1 title=Top>&#128285;</a><details style=display:inline-block; open><summary>Animated GIF version below (and double click it for popup view) ...</summary><img ondblclick=ondblc(this); id=mygif src=/agifwp" . server_remote_addr() . ".gif?rand=" . rand(0,675434) . "></img>" . str_replace("'", "' + String.fromCharCode(39) + '", str_replace('</head>','',str_replace('<head>','',$headscript))) . "'; } } " . $filterrework . " \"></body></html>";
     } else {
     echo "<html><body onload=\" if (parent.document.getElementById('slide' + 'showdiv')) { parent.document.getElementById('slideshowdiv').style.height='1980px'; } if (parent.document.getElementById('divcowpf')) { if (parent.document.getElementById('mygif')) { parent.document.getElementById('mygif').src='data:image/gif;base64," . base64_encode(file_get_contents('/tmp/agifwp' . server_remote_addr() . '.gif')) . "'; } else {  parent.document.getElementById('divcowpf').innerHTML+='<br><a style=display:inline-block;vertical-align:top; href=#myh1 title=Top>&#128285;</a><details style=display:inline-block; open><summary>Animated GIF version below (and double click it for popup view) ...</summary><img ondblclick=ondblc(this); id=mygif src=' + String.fromCharCode(39) + 'data:image/gif;base64," . base64_encode(file_get_contents('/tmp/agifwp' . server_remote_addr() . '.gif')) . "' + String.fromCharCode(39) + '></img>" . str_replace("'", "' + String.fromCharCode(39) + '", str_replace('</head>','',str_replace('<head>','',$headscript))) . "</details>'; } }  \"></body></html>";
     }
     exit;
   } else if (isset($_GET['fontlist'])) {
     $selpop='';
     if (!file_exists('/tmp/imfl.txt')) {
         exec('convert -list font > /tmp/imfl.txt');
     }
     $fcont=file_get_contents('/tmp/imfl.txt');
     if (strpos($fcont, 'family: ') !== false) {
       $fcs=explode('family: ', $fcont);
       for ($iuy=1; $iuy<sizeof($fcs); $iuy++) {
        if (strpos($selpop, '>' . explode("\n", $fcs[$iuy])[0] . '<') === false) {
         $selpop.="\n selo.innerHTML+='<option value=' + String.fromCharCode(39) + '" . explode("\n", $fcs[$iuy])[0] . "' + String.fromCharCode(39) + '>" . explode("\n", $fcs[$iuy])[0] . "</option>'; \n";
        }
       }
       if ($selpop != '') {
         echo "<html><body onload=\" var selos=null, parurl=''; if (window.opener) { parurl=window.opener.document.URL; selos=window.opener.document.getElementsByTagName('select'); } else { parurl=parent.document.URL;  selos=parent.document.getElementsByTagName('select'); } if (eval('' + selos.length) > 0) { var selo=null; if (parurl.indexOf('/haiku_') != -1) { selo=selos[0]; } else { selo=selos[eval(-1 + selos.length)]; }  " . $selpop . " selo.style.display='inline-block';  selo.style.backgroundColor='#f0f0f0';   } \"></body></html>";
       }
     }
     exit;
   } else if (isset($_POST['text'])) {
     $perlemoji='';
     $emojilabbit="@- ";  // vs perl
     $iex='png';
     $fnt='Courier';
     $wdt='800';
     $hgt='800';
     $psiz='36';
     $fcol='black';
     $bcol='white';
     if (isset($_POST['ext'])) {  $iex=str_replace('+',' ',urldecode($_POST['ext']));  }
     if (isset($_POST['ffam'])) {  $fnt=str_replace('+',' ',urldecode($_POST['ffam']));  }
     if (isset($_POST['width'])) {  $pwdt=str_replace('+',' ',urldecode($_POST['width']));  }
     if (isset($_POST['height'])) {  $hgt=str_replace('+',' ',urldecode($_POST['height']));  }
     if (isset($_POST['ptsize'])) {  $psiz=str_replace('+',' ',urldecode($_POST['ptsize']));  }
     if (isset($_POST['fcol'])) {  $fcol=str_replace('+',' ',urldecode($_POST['fcol']));  }
     if (isset($_POST['bcol'])) {  $bcol=str_replace('+',' ',urldecode($_POST['bcol']));  }
     $slidename='/tmp/imagerequest_' . server_remote_addr() . '-0.' . $iex;
     file_put_contents('/tmp/imagerequest_' . server_remote_addr() . '-0.txt', str_replace('+',' ',urldecode($_POST['text'])));
     file_put_contents('/tmp/maybeemojisP.txt', htmlspecialchars(str_replace('+',' ',urldecode($_POST['text'])), ENT_COMPAT,'UTF-8', true));
     // yes no &amp;#129684;
     if (strpos(str_replace('+',' ',urldecode($_POST['text'])), '&amp;#') !== false || strpos(str_replace('+',' ',urldecode($_POST['text'])), '&#') !== false) {  // thanks to https://usage.imagemagick.org/text/#unicode
         $outsofar=''; // '\x{201C}Unicode \x{2018}\x{263A}\x{2019} Please\x{201D}'
         if (strpos(str_replace('+',' ',urldecode($_POST['text'])), '&amp;#') !== false) {
           $outs=explode('&amp;#', str_replace('+',' ',urldecode($_POST['text'])));
           $outsofar=$outs[0];
           for ($ivx=1; $ivx<sizeof($outs); $ivx++) {
             $decis=explode(';', $outs[$ivx])[0];
             if (str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',$decis)))))))))) != '') {
             if (substr(strtolower($decis),0,1) == 'x') {
             $outsofar.="\\x{" . substr($decis,1) . "}";
             } else {
             $outsofar.="\\x{" . $decis . "}";
             }
             } else {
             $outsofar.="\\x{" . dechex($decis) . "}";
             }
             $outsofar.=substr($outs[$ivx],strlen($decis . ';'));
           }
         } else if (strpos(str_replace('+',' ',urldecode($_POST['text'])), '&#') !== false) {
           $outs=explode('&#', str_replace('+',' ',urldecode($_POST['text'])));
           $outsofar=$outs[0];
           for ($ivx=1; $ivx<sizeof($outs); $ivx++) {
             $decis=explode(';', $outs[$ivx])[0];
             if (str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',$decis)))))))))) != '') {
             if (substr(strtolower($decis),0,1) == 'x') {
             $outsofar.="\\x{" . substr($decis,1) . "}";
             } else {
             $outsofar.="\\x{" . $decis . "}";
             }
             } else {
             $outsofar.="\\x{" . dechex($decis) . "}";
             }
             $outsofar.=substr($outs[$ivx],strlen($decis . ';'));
           }
         }
         $labbit=$emojilabbit;
         $perlemoji="perl -e 'binmode(STDOUT, \":utf8\"); print \"" . str_replace("\n", "\x{000A}", $outsofar) . '";' . "' | ";
     }
     if (strpos(str_replace('+',' ',urldecode($_POST['text'])), "\\") !== false) {
     if ($perlemoji == '') { $labbit='"$(cat /tmp/imagerequest_' . server_remote_addr() . '-0.txt | ' . " sed '/\\\\/s//\\\\\\\\/g')" . '" '; }
     file_put_contents('/tmp/imag.cmd', $perlemoji . 'convert -background "' . $bcol . '" -fill "' . $fcol . '" -size ' . $wdt . 'x' . $hgt . ' -font ' . $fnt . ' -pointsize ' . $psiz . ' label:' . $labbit . ' ' . $slidename);
     exec($perlemoji . 'convert -background "' . $bcol . '" -fill "' . $fcol . '" -size ' . $wdt . 'x' . $hgt . ' -font ' . $fnt . ' -pointsize ' . $psiz . ' label:' . $labbit . ' ' . $slidename);
     exec('chmod 777 ' . $slidename);
     } else {
     if ($perlemoji == '') { $labbit='"$(cat /tmp/imagerequest_' . server_remote_addr() . '-0.txt)' . '" '; }
     file_put_contents('/tmp/imaG.cmd', $perlemoji . 'convert -background "' . $bcol . '" -fill "' . $fcol . '" -size ' . $wdt . 'x' . $hgt . ' -font ' . $fnt . ' -pointsize ' . $psiz . ' label:' . $labbit . ' ' . $slidename . ' ; chmod 777 ' . $slidename);
     exec($perlemoji . 'convert -background "' . $bcol . '" -fill "' . $fcol . '" -size ' . $wdt . 'x' . $hgt . ' -font ' . $fnt . ' -pointsize ' . $psiz . ' label:' . $labbit . ' ' . $slidename);
     exec('chmod 777 ' . $slidename);
     }
     if (isset($_POST['raw'])) {
     header('Content-Type: image/' . $iex);
     echo file_get_contents($slidename);
     unlink($slidename);
     unlink('/tmp/imagerequest_' . server_remote_addr() . '-0.txt');
     exit;
     } else {
     echo "<html>
     <body onload=\"
       if (window.parent != window.self) {
       var cnvs=parent.document.getElementsByTagName('canvas');
       if (eval('' + cnvs.length) > 0) {
         var imgsis=new Image();
         imgsis.onload=function(event){
           var canvasis=cnvs[0];
           var cntxis=canvasis.getContext('2d');
           cntxis.drawImage(event.target, 0, 0);
         };
         imgsis.src='data:image/" . $iex . ";base64," . base64_encode(file_get_contents($slidename)) . "'; 
       } else {
       var imgs=parent.document.getElementsByTagName('img');
       if (eval('' + imgs.length) > 0) {
         imgs[0].src='data:image/" . $iex . ";base64," . base64_encode(file_get_contents($slidename)) . "'; 
       } else if (document.body.innerHTML == '') { 
         document.body.innerHTML='<img src=data:image/" . $iex . ";base64," . base64_encode(file_get_contents($slidename)) . "></img><style> * { margin:0 0 0 0; padding:0 0 0 0; } img {  border-top: 8px solid " . $bcol . "; }</style>'; 
       } else { 
         document.body.innerHTML+='<br><img src=data:image/" . $iex . ";base64," . base64_encode(file_get_contents($slidename)) . "></img>'; 
       }
       }
       } else if (document.body.innerHTML == '') { 
         document.body.innerHTML='<img src=data:image/" . $iex . ";base64," . base64_encode(file_get_contents($slidename)) . "></img><style> * { margin:0 0 0 0; padding:0 0 0 0; } img {  border-top: 8px solid " . $bcol . "; }</style>'; 
       } else {
         document.body.innerHTML+='<br><img src=data:image/" . $iex . ";base64," . base64_encode(file_get_contents($slidename)) . "></img>'; 
       }
     \"></body></html>";
     unlink('/tmp/imagerequest_' . server_remote_addr() . '-0.txt');
     try {
     unlink($slidename);
     } catch(Exception $esdw) {   }
     }
     exit;
   } else if (isset($_GET['text'])) {
     $perlemoji='';
     $emojilabbit="@- ";  // vs perl
     $iex='png';
     $fnt='Courier';
     $wdt='800';
     $hgt='800';
     $psiz='36';
     $fcol='black';
     $bcol='white';
     if (isset($_GET['ext'])) {  $iex=str_replace('+',' ',urldecode($_GET['ext']));  }
     if (isset($_GET['ffam'])) {  $fnt=str_replace('+',' ',urldecode($_GET['ffam']));  }
     if (isset($_GET['width'])) {  $pwdt=str_replace('+',' ',urldecode($_GET['width']));  }
     if (isset($_GET['height'])) {  $hgt=str_replace('+',' ',urldecode($_GET['height']));  }
     if (isset($_GET['ptsize'])) {  $psiz=str_replace('+',' ',urldecode($_GET['ptsize']));  }
     if (isset($_GET['fcol'])) {  $fcol=str_replace('+',' ',urldecode($_GET['fcol']));  }
     if (isset($_GET['bcol'])) {  $bcol=str_replace('+',' ',urldecode($_GET['bcol']));  }
     $slidename='/tmp/imagerequest_' . server_remote_addr() . '-0.' . $iex;
     file_put_contents('/tmp/imagerequest_' . server_remote_addr() . '-0.txt', str_replace('+',' ',urldecode($_GET['text'])));
     file_put_contents('/tmp/maybeemojisG.txt', htmlspecialchars(str_replace('+',' ',urldecode($_GET['text'])), ENT_COMPAT,'UTF-8', true));
     // yes no &amp;#129684;
     if (strpos(str_replace('+',' ',urldecode($_GET['text'])), '&amp;#') !== false || strpos(str_replace('+',' ',urldecode($_GET['text'])), '&#') !== false) { // thanks to https://usage.imagemagick.org/text/#unicode
         $outsofar=''; // '\x{201C}Unicode \x{2018}\x{263A}\x{2019} Please\x{201D}'
         if (strpos(str_replace('+',' ',urldecode($_GET['text'])), '&amp;#') !== false) {
           $outs=explode('&amp;#', str_replace('+',' ',urldecode($_GET['text'])));
           $outsofar=$outs[0];
           for ($ivx=1; $ivx<sizeof($outs); $ivx++) {
             $decis=explode(';', $outs[$ivx])[0];
             if (str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',$decis)))))))))) != '') {
             if (substr(strtolower($decis),0,1) == 'x') {
             $outsofar.="\\x{" . substr($decis,1) . "}";
             } else {
             $outsofar.="\\x{" . $decis . "}";
             }
             } else {
             $outsofar.="\\x{" . dechex($decis) . "}";
             }
             $outsofar.=substr($outs[$ivx],strlen($decis . ';'));
           }
         } else if (strpos(str_replace('+',' ',urldecode($_GET['text'])), '&#') !== false) {
           $outs=explode('&#', str_replace('+',' ',urldecode($_GET['text'])));
           $outsofar=$outs[0];
           for ($ivx=1; $ivx<sizeof($outs); $ivx++) {
             $decis=explode(';', $outs[$ivx])[0];
             if (str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',$decis)))))))))) != '') {
             if (substr(strtolower($decis),0,1) == 'x') {
             $outsofar.="\\x{" . substr($decis,1) . "}";
             } else {
             $outsofar.="\\x{" . $decis . "}";
             }
             } else {
             $outsofar.="\\x{" . dechex($decis) . "}";
             }
             $outsofar.=substr($outs[$ivx],strlen($decis . ';'));
           }
         }
         $labbit=$emojilabbit;
         $perlemoji="perl -e 'binmode(STDOUT, \":utf8\"); print \"" . str_replace("\n", "\x{000A}", $outsofar) . '";' . "' | ";
     }
     if (strpos(str_replace('+',' ',urldecode($_GET['text'])), "\\") !== false) {
     if ($perlemoji == '') { $labbit='"$(cat /tmp/imagerequest_' . server_remote_addr() . '-0.txt | ' . " sed '/\\\\/s//\\\\\\\\/g')" . '" '; }
     //file_put_contents('/tmp/imag.cmd', 'convert -background "' . $bcol . '" -fill "' . $fcol . '" -size ' . $wdt . 'x' . $hgt . ' -font ' . $fnt . ' -pointsize ' . $psiz . ' label:"$(cat /tmp/imagerequest_' . server_remote_addr() . '-0.txt | ' . " sed '/\\\\/s//\\\\\\\\/g')" . '" ' . $slidename . ' ; chmod 777 ' . $slidename);
     exec($perlemoji . 'convert -background "' . $bcol . '" -fill "' . $fcol . '" -size ' . $wdt . 'x' . $hgt . ' -font ' . $fnt . ' -pointsize ' . $psiz . ' label:' . $labbit . ' ' . $slidename);
     exec('chmod 777 ' . $slidename);
     } else {
     if ($perlemoji == '') { $labbit='"$(cat /tmp/imagerequest_' . server_remote_addr() . '-0.txt)' . '" '; }
     exec($perlemoji . 'convert -background "' . $bcol . '" -fill "' . $fcol . '" -size ' . $wdt . 'x' . $hgt . ' -font ' . $fnt . ' -pointsize ' . $psiz . ' label:' . $labbit . ' ' . $slidename);
     exec('chmod 777 ' . $slidename);
     }
     if (isset($_GET['raw'])) {
     header('Content-Type: image/' . $iex);
     echo file_get_contents($slidename);
     unlink($slidename);
     unlink('/tmp/imagerequest_' . server_remote_addr() . '-0.txt');
     exit;
     } else {
     echo "<html>
     <body onload=\"
       if (window.parent != window.self) {
       var cnvs=parent.document.getElementsByTagName('canvas');
       if (eval('' + cnvs.length) > 0) {
         var imgsis=new Image();
         imgsis.onload=function(event){
           var canvasis=cnvs[0];
           var cntxis=canvasis.getContext('2d');
           cntxis.drawImage(event.target, 0, 0);
         };
         imgsis.src='data:image/" . $iex . ";base64," . base64_encode(file_get_contents($slidename)) . "'; 
       } else {
       var imgs=parent.document.getElementsByTagName('img');
       if (eval('' + imgs.length) > 0) {
         imgs[0].src='data:image/" . $iex . ";base64," . base64_encode(file_get_contents($slidename)) . "'; 
       } else if (document.body.innerHTML == '') { 
         document.body.innerHTML='<img src=data:image/" . $iex . ";base64," . base64_encode(file_get_contents($slidename)) . "></img><style> * { margin:0 0 0 0; padding:0 0 0 0; } img {  border-top: 8px solid " . $bcol . "; }</style>'; 
       } else { 
         document.body.innerHTML+='<br><img src=data:image/" . $iex . ";base64," . base64_encode(file_get_contents($slidename)) . "></img>'; 
       }
       }
       } else if (document.body.innerHTML == '') { 
         document.body.innerHTML='<img src=data:image/" . $iex . ";base64," . base64_encode(file_get_contents($slidename)) . "></img><style> * { margin:0 0 0 0; padding:0 0 0 0; } img {  border-top: 8px solid " . $bcol . "; }</style>'; 
       } else {
         document.body.innerHTML+='<br><img src=data:image/" . $iex . ";base64," . base64_encode(file_get_contents($slidename)) . "></img>'; 
       }
     \"></body></html>";
     unlink('/tmp/imagerequest_' . server_remote_addr() . '-0.txt');
     try {
     unlink($slidename);
     } catch(Exception $esdw) {   }
     }
     exit;
   } else if (isset($_GET['getvideo'])) {
     $lenv='1';
     if (isset($_GET['len'])) {
       $lenv=$_GET['len'];
     }
     if ($_GET['getvideo'] == '1' && $lenv == '0') {
     echo "<html><body onload=\" if (parent.document.getElementById('divvideo')) {  parent.document.getElementById('divvideo').innerHTML='<video id=myvideo controls><source id=mysource type=video/mp4 src=' + String.fromCharCode(39) + 'data:video/mp4;base64," . base64_encode(file_get_contents('/tmp/video' . server_remote_addr() . '.mp4')) . "' + String.fromCharCode(39) + '></source></video>'; } else if (parent.document.getElementById('mysource')) { parent.document.getElementById('mysource').src='data:video/mp4;base64," . base64_encode(file_get_contents('/tmp/video' . server_remote_addr() . '.mp4')) . "';  } else { parent.document.getElementById('divmedia').innerHTML+='<br><br><p id=pvd>Video version below ... <a style=display:inline-block; href=#myh1>Back to top ...</a></p><br><div id=divvideo><video id=myvideo controls><source id=mysource type=video/mp4 src=' + String.fromCharCode(39) + 'data:video/mp4;base64," . base64_encode(file_get_contents('/tmp/video' . server_remote_addr() . '.mp4')) . "' + String.fromCharCode(39) + '></source></video></div>'; } setTimeout(function(){ parent.document.getElementById('pvd').scrollIntoView(); }, 2000); \"></body></html>";
     } else {
     if (file_exists('/tmp/video' . server_remote_addr() . '.mp4')) {
       unlink('/tmp/video' . server_remote_addr() . '.mp4');
     }
     //exec('ffmpeg -framerate 2 -i /tmp/slide_' . server_remote_addr() . '-%03d.png -vcodec libx264 -crf 22 /tmp/video' . server_remote_addr() . '.mp4');
     exec('ffmpeg -framerate ' . $fps . ' -i /tmp/slide_' . server_remote_addr() . '-%03d.png -c:v libx264 -pix_fmt yuv420p -profile:v main -level:v 3.1 -vf fps=' . $fps . ' -an /tmp/video' . server_remote_addr() . '.mp4');
     echo "<html><body onload=\" if (parent.document.getElementById('divvideo')) {  parent.document.getElementById('divvideo').innerHTML='<video id=myvideo controls><source id=mysource type=video/mp4 src=' + String.fromCharCode(39) + 'data:video/mp4;base64," . base64_encode(file_get_contents('/tmp/video' . server_remote_addr() . '.mp4')) . "' + String.fromCharCode(39) + '></source></video>'; } else if (parent.document.getElementById('mysource')) { parent.document.getElementById('mysource').src='data:video/mp4;base64," . base64_encode(file_get_contents('/tmp/video' . server_remote_addr() . '.mp4')) . "';  } else { parent.document.getElementById('divmedia').innerHTML+='<br><br><p id=pvd>Video version below ... <a style=display:inline-block; href=#myh1>Back to top ...</a></p><br><div id=divvideo><video id=myvideo controls><source id=mysource type=video/mp4 src=' + String.fromCharCode(39) + 'data:video/mp4;base64," . base64_encode(file_get_contents('/tmp/video' . server_remote_addr() . '.mp4')) . "' + String.fromCharCode(39) + '></source></video></div>'; } setTimeout(function(){ parent.document.getElementById('pvd').scrollIntoView(); }, 2000); \"></body></html>";
     }
     exit;
   } else if (isset($_GET['getagif'])) {
     $lenv='1';
     if (isset($_GET['len'])) {
       $lenv=$_GET['len'];
     }
     if ($_GET['getagif'] == '1' && $lenv == '0') {
     echo "<html><body onload=\" if (parent.document.getElementById('mygif')) { parent.document.getElementById('mygif').src='data:image/gif;base64," . base64_encode(file_get_contents('/tmp/agif' . server_remote_addr() . '.gif')) . "';  } else { parent.document.getElementById('divmedia').innerHTML+='<br><br><p id=pag>Animated GIF version below ... <a style=display:inline-block; href=#myh1>Back to top ...</a></p><br><img id=mygif src=data:image/gif;base64," . base64_encode(file_get_contents('/tmp/agif' . server_remote_addr() . '.gif')) . "></img>'; }   setTimeout(function(){ parent.document.getElementById('pag').scrollIntoView(); }, 2000);   \"></body></html>";
     } else {
     if (file_exists('/tmp/agif' . server_remote_addr() . '.gif')) {
       unlink('/tmp/agif' . server_remote_addr() . '.gif');
     }
     exec('ffmpeg -framerate ' . $fps . ' -i /tmp/slide_' . server_remote_addr() . '-%03d.png -vf fps=' . $fps . ' /tmp/agif' . server_remote_addr() . '.gif');
     echo "<html><body onload=\" if (parent.document.getElementById('mygif')) { parent.document.getElementById('mygif').src='data:image/gif;base64," . base64_encode(file_get_contents('/tmp/agif' . server_remote_addr() . '.gif')) . "';  } else { parent.document.getElementById('divmedia').innerHTML+='<br><br><p id=pag>Animated GIF version below ... <a style=display:inline-block; href=#myh1>Back to top ...</a></p><br><img id=mygif src=data:image/gif;base64," . base64_encode(file_get_contents('/tmp/agif' . server_remote_addr() . '.gif')) . "></img>'; }   setTimeout(function(){ parent.document.getElementById('pag').scrollIntoView(); }, 2000);   \"></body></html>";
     }
     exit;
   } else if (isset($_GET['inwords'])) {
     if (isset($_GET['curc'])) {
      if ($_GET['curc'] == '1') {
        foreach (glob('/tmp/slide_' . server_remote_addr() . '-*.png') as $ifil) {
          unlink($ifil);
        }
      }
      $slidename='/tmp/slide_' . server_remote_addr() . '-' . substr(('000' . $_GET['curc']),-3,3) . '.png';
      if ($_GET['curc'] != '1') {
       $tabbit=" if (window.parent) { if (parent.document.getElementById('trtdtd" . $_GET['curc'] . "')) {  parent.appendthenfill(); } } ";
      } else {
       $tabbit='';
      }
     } else {
      $tabbit='';
     }
     if (isset($_GET['chr'])) {
       $suff=' -c "' . str_replace('+',' ',urldecode($_GET['chr'])) . '" ';
     }
     if (!file_exists('/tmp/cowsay.wds')) {
         $serious=true; 
         file_put_contents('/tmp/cowsay.wds', $_GET['inwords']);  
     } else if (substr(file_get_contents('/tmp/cowsay.wds'),0,strlen($_GET['inwords'])) == $_GET['inwords']) {
         $serious=false;
     } else {
         $serious=true; 
         file_put_contents('/tmp/cowsay.wds', $_POST['inwords']);  
     }
     if (isset($_GET['and']) && file_exists('/tmp/cowsay.txt')) {
     if (isset($_GET['outdrawing'])) {
       file_put_contents('/tmp/cowsay.txt', str_replace('+',' ',urldecode($_GET['outdrawing'])));
     }
     if (file_exists('/tmp/cowsaytwo.txt')) { unlink('/tmp/cowsaytwo.txt');  }
     if (file_exists('/tmp/cowsaythree.txt')) { unlink('/tmp/cowsaythree.txt');  }
     if (file_exists('/tmp/cowsayzero.txt')) { unlink('/tmp/cowsayzero.txt');  }
     exec("awk '{print length}' /tmp/cowsay.txt |sort -nr|head -1 | sed 's/[^0-9]//g' > /tmp/cowsayzn.txt");
     if (isset($_GET['maxl'])) {
     exec("cat /tmp/cowsay.txt | sed 's/ /:/g' | awk '{printf \"%-" . $_GET['maxl'] . "s\n\", $1}' | sed 's/:/ /g' > /tmp/cowsayzero.txt");
     } else {
     exec("cat /tmp/cowsay.txt | sed 's/ /:/g' | awk '{printf \"%-`cat /tmp/cowsayzn.txt | sed 's/[^0-9]//g'`s\n\", $1}' | sed 's/:/ /g' > /tmp/cowsayzero.txt");
     }
     exec("cat /tmp/cowsayzero.txt | head -1 | sed 's/[^\ ]/\ /g' > /tmp/cowsaynone.txt");
     for ($i=0; $i<=100; $i++) {
        exec("cat /tmp/cowsaynone.txt >> /tmp/cowsayzero.txt");
     }
     if ($serious) {
     $three='three';
     exec('cowsay' . $suff . ' -t "' . str_replace('+',' ',urldecode($_GET['inwords'])) . '" > /tmp/cowsaytwo.txt ; pr -m -t -w 500 /tmp/cowsayzero.txt /tmp/cowsaytwo.txt > /tmp/cowsaythree.txt'); // ; cp -f /tmp/cowsaythree.txt /tmp/cowsay.txt');
     if ($slidename != '') {
     if (strpos(file_get_contents('/tmp/cowsaytwo.txt'), "\\") !== false) {
     //exec('convert -background "' . $bcol . '" -fill "' . $fcol . '" -size ' . $wdt . 'x' . $hgt . ' -font ' . $fnt . ' -pointsize ' . $psiz . ' label:"$(cat /tmp/imagerequest_' . server_remote_addr() . '-0.txt | ' . " sed '/ \\\\/s// \\\\\\\\/g')" . '" ' . $slidename);
     exec('convert -background white -fill black -size 800x800 -font Courier -pointsize ' . $pts . ' label:"$(cat /tmp/cowsaytwo.txt | ' . " sed '/\\\\/s//\\\\\\\\/g')" . '" ' . $slidename);
     } else {
     exec('convert -background white -fill black -size 800x800 -font Courier -pointsize ' . $pts . ' label:"$(cat /tmp/cowsaytwo.txt | ' . " sed '/\\\\/s//`/g')" . '" ' . $slidename);
     }
     }
     if ($tabbit != '') {  $tabbit=str_replace('()', "('" . urlencode(file_get_contents('/tmp/cowsaytwo.txt')) . "')", $tabbit); }
     } else {
     exec('cowsay' . $suff . ' -t "' . str_replace('+',' ',urldecode($_GET['inwords'])) . '" > /tmp/cowsaytwo.txt ; pr -m -t -w 500 /tmp/cowsayzero.txt /tmp/cowsaytwo.txt > /tmp/cowsaythree.txt');
     if ($slidename != '') {
     if (strpos(file_get_contents('/tmp/cowsaytwo.txt'), "\\") !== false) {
     //exec('convert -background "' . $bcol . '" -fill "' . $fcol . '" -size ' . $wdt . 'x' . $hgt . ' -font ' . $fnt . ' -pointsize ' . $psiz . ' label:"$(cat /tmp/imagerequest_' . server_remote_addr() . '-0.txt | ' . " sed '/ \\\\/s// \\\\\\\\/g')" . '" ' . $slidename);
     exec('convert -background white -fill black -size 800x800 -font Courier -pointsize ' . $pts . ' label:"$(cat /tmp/cowsaytwo.txt | ' . " sed '/\\\\/s//\\\\\\\\/g')" . '" ' . $slidename);
     } else {
     exec('convert -background white -fill black -size 800x800 -font Courier -pointsize ' . $pts . ' label:"$(cat /tmp/cowsaytwo.txt | ' . " sed '/\\\\/s//`/g')" . '" ' . $slidename);
     }
     }
     if ($tabbit != '') {  $tabbit=str_replace('()', "('" . urlencode(file_get_contents('/tmp/cowsaytwo.txt')) . "')", $tabbit); }
     }
     //if (file_exists('/tmp/cowsaytwo.txt')) { unlink('/tmp/cowsaytwo.txt');  }
     echo "<html><head><title>Cow Says ... thanks to https://pypi.org/project/cowsay</title><meta charset='UTF-8'/></head><body onload=\"if (window.parent) { if (parent.document.getElementById('result')) {  parent.document.getElementById('result').style.textShadow='-1px 1px 1px #952dff'; parent.document.getElementById('result').value=''; parent.document.getElementById('result').value=decodeURIComponent('" . urlencode(file_get_contents('/tmp/cowsay' . $three . '.txt')) . "').replace(/\+/g,' ').replace(/\ /g,'&nbsp;'); if (1 == 3) { parent.document.getElementById('result').style.fontFamily='Courier New'; }  parent.document.getElementById('result').style.fontSize='8px';  parent.document.getElementById('result').title='Double click for more ... thanks to https://pypi.org/project/cowsay'; parent.document.getElementById('result').ondblclick=function(){ window.open('/cowsay.php','_blank','top=100,left=100,width=600,height=600'); };   }  }\"><textarea id=dta title='Double click for another Cow Says pearl of wisdom.' ondblclick=\"location.href='/cowsay.php';\" style='width:98%;height:90%;border:2px dotted red;font-size:8px;'>" . file_get_contents('/tmp/cowsaythree.txt') . "</textarea></body></html>";
     } else {
     exec('cowsay' . $suff . ' -t "' . str_replace('+',' ',urldecode($_GET['inwords'])) . '" > /tmp/cowsay.txt');
     if ($slidename != '') {
     if (strpos(file_get_contents('/tmp/cowsay.txt'), "\\") !== false) {
     exec('convert -background white -fill black -size 800x800 -font Courier -pointsize ' . $pts . ' label:"$(cat /tmp/cowsay.txt | ' . " sed '/\\\\/s//\\\\\\\\/g')" . '" ' . $slidename);
     } else {
     exec('convert -background white -fill black -size 800x800 -font Courier -pointsize ' . $pts . ' label:"$(cat /tmp/cowsay.txt | ' . " sed '/\\\\/s//`/g')" . '" ' . $slidename);
     }
     }
     echo "<html><head><title>Cow Says ... thanks to https://pypi.org/project/cowsay</title><meta charset='UTF-8'/></head><body onload=\"if (window.parent) { if (parent.document.getElementById('result')) {  parent.document.getElementById('result').style.textShadow='-1px 1px 1px #952dff'; parent.document.getElementById('result').value=''; parent.document.getElementById('result').value=decodeURIComponent('" . urlencode(file_get_contents('/tmp/cowsay.txt')) . "').replace(/\+/g,' ').replace(/\ /g,'&nbsp;'); if (1 == 3) { parent.document.getElementById('result').style.fontFamily='Courier New'; }  parent.document.getElementById('result').style.fontSize='8px';  parent.document.getElementById('result').title='Double click for more ... thanks to https://pypi.org/project/cowsay'; parent.document.getElementById('result').ondblclick=function(){ window.open('/cowsay.php','_blank','top=100,left=100,width=600,height=600'); };   }  }\"><textarea id=dta title='Double click for another Cow Says pearl of wisdom.' ondblclick=\"location.href='/cowsay.php';\" style='width:98%;height:90%;border:2px dotted red;font-size:8px;'>" . file_get_contents('/tmp/cowsay.txt') . "</textarea></body></html>";
     }
     exit;
   } else if (isset($_POST['inwords'])) {
     if (isset($_POST['curc'])) {
      if ($_POST['curc'] == '1') {
        foreach (glob('/tmp/slide_' . server_remote_addr() . '-*.png') as $ifil) {
          unlink($ifil);
        }
      }
      $slidename='/tmp/slide_' . server_remote_addr() . '-' . substr(('000' . $_POST['curc']),-3,3) . '.png';
      if ($_POST['curc'] != '1') {
       $tabbit=" if (window.parent) { if (parent.document.getElementById('trtdtd" . $_POST['curc'] . "')) {  parent.appendthenfill(); } } ";
      } else {
       $tabbit='';
      }
     } else {
      $tabbit='';
     }
     if (isset($_POST['chr'])) {
       $suff=' -c "' . str_replace('+',' ',urldecode($_POST['chr'])) . '" ';
     }
     if (!file_exists('/tmp/cowsay.wds')) {
         $serious=true; 
         file_put_contents('/tmp/cowsay.wds', $_POST['inwords']);  
     } else if (substr(file_get_contents('/tmp/cowsay.wds'),0,strlen($_POST['inwords'])) == $_POST['inwords']) {
         $serious=false;
     } else {
         $serious=true; 
         file_put_contents('/tmp/cowsay.wds', $_POST['inwords']);  
     }
     if (isset($_POST['and']) && file_exists('/tmp/cowsay.txt')) {
     if (isset($_POST['outdrawing'])) {
       file_put_contents('/tmp/cowsay.txt', str_replace('+',' ',urldecode($_POST['outdrawing'])));
     }
     if (file_exists('/tmp/cowsaytwo.txt')) { unlink('/tmp/cowsaytwo.txt');  }
     if (file_exists('/tmp/cowsaythree.txt')) { unlink('/tmp/cowsaythree.txt');  }
     if (file_exists('/tmp/cowsayzero.txt')) { unlink('/tmp/cowsayzero.txt');  }
     exec("awk '{print length}' /tmp/cowsay.txt |sort -nr|head -1 | sed 's/[^0-9]//g' > /tmp/cowsayzn.txt");
     if (isset($_POST['maxl'])) {
     exec("cat /tmp/cowsay.txt | sed 's/ /:/g' | awk '{printf \"%-" . $_POST['maxl'] . "s\n\", $1}' | sed 's/:/ /g' > /tmp/cowsayzero.txt");
     } else {
     exec("cat /tmp/cowsay.txt | sed 's/ /:/g' | awk '{printf \"%-`cat /tmp/cowsayzn.txt | sed 's/[^0-9]//g'`s\n\", $1}' | sed 's/:/ /g' > /tmp/cowsayzero.txt");
     }
     exec("cat /tmp/cowsayzero.txt | head -1 | sed 's/[^\ ]/\ /g' > /tmp/cowsaynone.txt");
     for ($i=0; $i<=100; $i++) {
        exec("cat /tmp/cowsaynone.txt >> /tmp/cowsayzero.txt");
     }
     if ($serious) {
     $three='three';
     exec('cowsay' . $suff . ' -t "' . str_replace('+',' ',urldecode($_POST['inwords'])) . '" > /tmp/cowsaytwo.txt ; pr -m -t -w 500 /tmp/cowsayzero.txt /tmp/cowsaytwo.txt > /tmp/cowsaythree.txt'); // ; cp -f /tmp/cowsaythree.txt /tmp/cowsay.txt');
     if ($slidename != '') {
     if (strpos(file_get_contents('/tmp/cowsaytwo.txt'), "\\") !== false) {
     //exec('convert -background "' . $bcol . '" -fill "' . $fcol . '" -size ' . $wdt . 'x' . $hgt . ' -font ' . $fnt . ' -pointsize ' . $psiz . ' label:"$(cat /tmp/imagerequest_' . server_remote_addr() . '-0.txt | ' . " sed '/ \\\\/s// \\\\\\\\/g')" . '" ' . $slidename);
     exec('convert -background white -fill black -size 800x800 -font Courier -pointsize ' . $pts . ' label:"$(cat /tmp/cowsaytwo.txt | ' . " sed '/\\\\/s//\\\\\\\\/g')" . '" ' . $slidename);
     } else {
     exec('convert -background white -fill black -size 800x800 -font Courier -pointsize ' . $pts . ' label:"$(cat /tmp/cowsaytwo.txt | ' . " sed '/\\\\/s//`/g')" . '" ' . $slidename);
     }
     }
     if ($tabbit != '') {  $tabbit=str_replace('()', "('" . urlencode(file_get_contents('/tmp/cowsaytwo.txt')) . "')", $tabbit); }
     } else {
     exec('cowsay' . $suff . ' -t "' . str_replace('+',' ',urldecode($_POST['inwords'])) . '" > /tmp/cowsaytwo.txt ; pr -m -t -w 500 /tmp/cowsayzero.txt /tmp/cowsaytwo.txt > /tmp/cowsaythree.txt');
     if ($slidename != '') {
     if (strpos(file_get_contents('/tmp/cowsaytwo.txt'), "\\") !== false) {
     //exec('convert -background "' . $bcol . '" -fill "' . $fcol . '" -size ' . $wdt . 'x' . $hgt . ' -font ' . $fnt . ' -pointsize ' . $psiz . ' label:"$(cat /tmp/imagerequest_' . server_remote_addr() . '-0.txt | ' . " sed '/ \\\\/s// \\\\\\\\/g')" . '" ' . $slidename);
     exec('convert -background white -fill black -size 800x800 -font Courier -pointsize ' . $pts . ' label:"$(cat /tmp/cowsaytwo.txt | ' . " sed '/\\\\/s//\\\\\\\\/g')" . '" ' . $slidename);
     } else {
     exec('convert -background white -fill black -size 800x800 -font Courier -pointsize ' . $pts . ' label:"$(cat /tmp/cowsaytwo.txt | ' . " sed '/\\\\/s//`/g')" . '" ' . $slidename);
     }
     }
     if ($tabbit != '') {  $tabbit=str_replace('()', "('" . urlencode(file_get_contents('/tmp/cowsaytwo.txt')) . "')", $tabbit); }
     }
     //if (file_exists('/tmp/cowsaytwo.txt')) { unlink('/tmp/cowsaytwo.txt');  }
     echo "<html><head><style>
 margin: 0 0 0 0;
 padding: 0 0 0 0;
 tr { vertical-align: top; }
 td { vertical-align: top; }
 th { vertical-align: top; }
 * { font-family:'Courier New',Courier,monospace; }
 .img-hor { // thanks to https://stackoverflow.com/questions/32875695/flip-mirror-an-image-horizontally-vertically-with-css
        -moz-transform: scaleX(-1);
        -o-transform: scaleX(-1);
        -webkit-transform: scaleX(-1);
        transform: scaleX(-1);
        filter: FlipH;
        -ms-filter: 'FlipH';
 }
</style><title>Cow Says ... thanks to https://pypi.org/project/cowsay</title><meta charset='UTF-8'/></head><body onload=\" " . $tabbit . " if (window.parent) { if (parent.document.getElementById('outdrawing')) {  parent.document.getElementById('outdrawing').value=parent.setlenthree(" . str_replace("\n","",file_get_contents('/tmp/cowsayzn.txt')) . ",decodeURIComponent('" . urlencode(file_get_contents('/tmp/cowsay.txt')) . "').replace(/\+/g,' '),decodeURIComponent('" . urlencode(file_get_contents('/tmp/cowsaytwo.txt')) . "').replace(/\+/g,' ')); } } if (window.parent) { if (parent.document.getElementById('result')) {  parent.document.getElementById('result').value=parent.setlen(" . str_replace("\n","",file_get_contents('/tmp/cowsayzn.txt')) . ",decodeURIComponent('" . urlencode(file_get_contents('/tmp/cowsay.txt')) . "').replace(/\+/g,' ')); parent.document.getElementById('result').style.fontFamily='Courier New';  parent.document.getElementById('result').style.fontSize='8px';  parent.document.getElementById('result').title='Double click for more ... thanks to https://pypi.org/project/cowsay'; parent.document.getElementById('result').ondblclick=function(){ window.open('/cowsay.php','_blank','top=100,left=100,width=600,height=600'); };   }  }\"><textarea id=dta title='Double click for another Cow Says pearl of wisdom.' ondblclick=\"location.href='/cowsay.php';\" style='width:98%;height:90%;border:2px dotted red;font-size:8px;'>" . file_get_contents('/tmp/cowsaythree.txt') . "</textarea></body></html>";
     } else {
     exec('cowsay' . $suff . ' -t "' . str_replace('+',' ',urldecode($_POST['inwords'])) . '" > /tmp/cowsay.txt');
     if ($slidename != '') {
     if (strpos(file_get_contents('/tmp/cowsay.txt'), "\\") !== false) {
     exec('convert -background white -fill black -size 800x800 -font Courier -pointsize ' . $pts . ' label:"$(cat /tmp/cowsay.txt | ' . " sed '/\\\\/s//\\\\\\\\/g')" . '" ' . $slidename);
     } else {
     exec('convert -background white -fill black -size 800x800 -font Courier -pointsize ' . $pts . ' label:"$(cat /tmp/cowsay.txt | ' . " sed '/\\\\/s//`/g')" . '" ' . $slidename);
     }
     }
     echo "<html><head><style>
 margin: 0 0 0 0;
 padding: 0 0 0 0;
 tr { vertical-align: top; }
 td { vertical-align: top; }
 th { vertical-align: top; }
 * { font-family:'Courier New',Courier,monospace; }
 .img-hor { // thanks to https://stackoverflow.com/questions/32875695/flip-mirror-an-image-horizontally-vertically-with-css
        -moz-transform: scaleX(-1);
        -o-transform: scaleX(-1);
        -webkit-transform: scaleX(-1);
        transform: scaleX(-1);
        filter: FlipH;
        -ms-filter: 'FlipH';
 }
</style><title>Cow Says ... thanks to https://pypi.org/project/cowsay</title><meta charset='UTF-8'/></head><body onload=\" " . $tabbit . " if (window.parent) { if (parent.document.getElementById('outdrawing')) {  parent.document.getElementById('outdrawing').value=parent.setlen(" . str_replace("\n","",file_get_contents('/tmp/cowsayzn.txt')) . ",decodeURIComponent('" . urlencode(file_get_contents('/tmp/cowsay.txt')) . "').replace(/\+/g,' ')); } } if (window.parent) { if (parent.document.getElementById('result')) {  parent.document.getElementById('result').value=parent.setlen(" . str_replace("\n","",file_get_contents('/tmp/cowsayzn.txt')) . ",decodeURIComponent('" . urlencode(file_get_contents('/tmp/cowsay.txt')) . "').replace(/\+/g,' ')); parent.document.getElementById('result').style.fontFamily='Courier New';  parent.document.getElementById('result').style.fontSize='8px';  parent.document.getElementById('result').title='Double click for more ... thanks to https://pypi.org/project/cowsay'; parent.document.getElementById('result').ondblclick=function(){ window.open('/cowsay.php','_blank','top=100,left=100,width=600,height=600'); };   }  }\"><textarea id=dta title='Double click for another Cow Says pearl of wisdom.' ondblclick=\"location.href='/cowsay.php';\" style='width:98%;height:90%;border:2px dotted red;font-size:8px;'>" . file_get_contents('/tmp/cowsay.txt') . "</textarea></body></html>";
     }
     exit;
   }
   
   echo "<html><head><title>Cow Says ... thanks to https://pypi.org/project/cowsay</title><meta charset='UTF-8'/>
<meta name='viewport' content='width=device-width, initial-scale=1, minimum-scale=0.1, maximum-scale=8, user-scalable=yes'  >
<style>
 margin: 0 0 0 0;
 padding: 0 0 0 0;
 tr { vertical-align: top; }
 td { vertical-align: top; }
 th { vertical-align: top; }
 * { font-family:'Courier New',Courier,monospace; }
 .img-hor { // thanks to https://stackoverflow.com/questions/32875695/flip-mirror-an-image-horizontally-vertically-with-css
        -moz-transform: scaleX(-1);
        -o-transform: scaleX(-1);
        -webkit-transform: scaleX(-1);
        transform: scaleX(-1);
        filter: FlipH;
        -ms-filter: 'FlipH';
 }
 .img-ver { // thanks to https://stackoverflow.com/questions/32875695/flip-mirror-an-image-horizontally-vertically-with-css
        -moz-transform: scaleY(-1);
        -o-transform: scaleY(-1);
        -webkit-transform: scaleY(-1);
        transform: scaleY(-1);
        filter: FlipV;
        -ms-filter: 'FlipV';
 }

 .glow {
  -webkit-animation: glow 1s linear infinite alternate;
  -moz-animation: glow 1s linear infinite alternate;
  animation: glow 1s linear infinite alternate;
 }

 /* Thanks to https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_glowing_text */

 @-webkit-keyframes glow {
  from {
    box-shadow: 0 0 3px #fff, 0 0 5px #fff, 0 0 37px #e60073, 0 0 9px #e60073, 0 0 11px #e60073, 0 0 13px #e60073, 0 0 15px #e60073;
  }

  to {
    box-shadow: 0 0 24px #fff, 0 0 6px #ff4da6, 0 0 8px #ff4da6, 0 0 10px #ff4da6, 0 0 12px #ff4da6, 0 0 14px #ff4da6, 0 0 16px #ff4da6;
  }
 }

th[id$='0'] { 
    background: rgba(224,240,240,0.6); //#e0f0f0;
}

th[id$='1'] { 
    background: rgba(225,241,241,0.6); //#e1f1f1;
}

th[id$='2'] {
    background: rgba(226,242,242,0.6); //#e2f2f2;
}

th[id$='3'] {
    background: rgba(227,243,243,0.6); //#e3f3f3;
}

th[id$='4'] {
    background: rgba(228,244,244,0.6); //#e4f4f4;
}

th[id$='5'] {
    background: rgba(229,245,245,0.6); //#e5f5f5;
}

th[id$='6'] {
    background: rgba(230,246,246,0.6); //#e6f6f6;
}

th[id$='7'] {
    background: rgba(231,247,247,0.6); //#e7f7f7;
}

th[id$='8'] {
    background: rgba(232,248,248,0.6); //#e2f2f2;
}

th[id$='9'] {
    background: rgba(233,249,249,0.6); //#e9f9f9;
}

td[id$='0'] {
    background: rgba(240,240,240,0.3); //#f0f0f0;
    text-shadow:-1px 1px 1px #ff2d90;
}

td[id$='1'] {
    background: rgba(241,241,241,0.3); //#f1f1f1;
    text-shadow:-1px 1px 1px #ff2d91;
    float: bottom;
}

td[id$='2'] {
    background: rgba(242,242,242,0.3); //#f2f2f2;
    text-shadow:-1px 1px 1px #ff2d92;
}

td[id$='3'] {
    background: rgba(243,243,243,0.3); //#f3f3f3;
    text-shadow:-1px 1px 1px #ff2d93;
}

td[id$='4'] {
    background: rgba(244,244,244,0.3); //#f4f4f4;
    text-shadow:-1px 1px 1px #ff2d94;
}

td[id$='5'] {
    background: rgba(245,245,245,0.3); //#f5f5f5;
    text-shadow:-1px 1px 1px #ff2d95;
}

td[id$='6'] {
    background: rgba(246,246,246,0.3); //#f6f6f6;
    text-shadow:-1px 1px 1px #ff2d96;
}

td[id$='7'] {
    background: rgba(247,247,247,0.3); //#f7f7f7;
    text-shadow:-1px 1px 1px #ff2d97;
}

td[id$='8'] {
    background: rgba(248,248,248,0.3); //#f8f8f8;
    text-shadow:-1px 1px 1px #ff2d98;
}

td[id$='9'] {
    background: rgba(249,249,249,0.3); //#f9f9f9;
    text-shadow:-1px 1px 1px #ff2d99;
}

table tbody tr:first-child {
    background: transparent; //#f6f6e6;
}
</style>
<script type=text/javascript>
   var fps='" . $fps . "';
   var pts='" . $pts . "';
   var gnewwithwhat='';
   var aconto=null;
   var randis=-1, randi=-1, randsofar='', fullrandis='', moder='';
   var eighty=0, topwo=null;
   var screenwidth=screen.width, screenheight=screen.height;
   var curcell=1, currow=1, initialtableih='';
   var celltemplate='<td id=\"td1\"><table tabspacing=0 tabpadding=0 id=\"tabtd1\"><tbody><tr id=\"trhtd1\"><th onblur=emsmrefresh(); id=\"trthtd1\" title=\"You can edit me.\" contenteditable=\"true\"></th></tr><tr id=\"trbtd1\"><td ontouchend=\"toppleme(this);\" oncontextmenu=\"toppleme(this);\" ondblclick=\"reverseme(this);\" title=\"Double click horizontally reverses, and right click vertically topples, and wording above is editable.\" id=\"trtdtd1\"></td></tr></tbody></table></td>';
   var speechtotextwo=null;
   //var isChromeWB = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
   var isChromeWB = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor) && !/OPR/.test(navigator.userAgent);
   if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    if (navigator.userAgent.match('CriOS')) {
    isChromeWB=true; //alert('' + isChromenm + ' ' + navigator.userAgent);
    }
   }

function window_open(a1,a2,a3) {
  if (topwo) {
    topwo.close();
    topwo=null;
  }
  return window.open(a1,a2,a3);
}

function anop() {
  if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    topwo=window_open('https://www.google.com/intl/en/chrome/demos/speech.html','_blank','top=120,left=' + eval(eval('' + screen.width) - 690) + ',width=690,height=550');
    setTimeout(function(){  topwo.scrollTo(0,0);  topwo.document.getElementById('tdm').style.opacity='0.0';   }, 6000);
    setInterval(function(){  if (!topwo.closed) { topwo.focus(); }  topwo.location.href='https://www.rjmprogramming.com.au/PHP/speech_supervisor.php?rand=' + Math.floor(Math.random() * 1987967) + '&mode=4';  setTimeout(function(){ topwo.scrollTo(0,0);   topwo.document.getElementById('tdm').style.opacity='0.0'; }, 6000);  }, 30000);
  } else {
    topwo=window.open('https://www.rjmprogramming.com.au/PHP/speech_supervisor.php?rand=' + Math.floor(Math.random() * 1987967) + '&mode=4','_blank','top=120,left=' + eval(eval('' + screen.width) - 690) + ',width=690,height=550');
    setTimeout(function(){  topwo.scrollTo(0,0);  topwo.document.getElementById('tdm').style.opacity='0.0';   }, 6000);
    setInterval(function(){ if (!topwo.closed) { topwo.focus(); } topwo.location.href='https://www.rjmprogramming.com.au/PHP/speech_supervisor.php?rand=' + Math.floor(Math.random() * 1987967) + '&mode=4';  setTimeout(function(){ topwo.scrollTo(0,0);   topwo.document.getElementById('tdm').style.opacity='0.0'; }, 6000);  }, 30000);
  }
}



  function is_ch() {
    is__chrome=false;
  }
  
  function rtrim(inzx) {
    var outzx=inzx;
    while ((' ' + outzx).slice(-1) == ' ' && outzx != '') {
     if (outzx != '') {
      if (('' + outzx.length) == '1') {
      outzx=='';
      } else {
      outzx=outzx.substring(0,eval(-1 + outzx.length));
      }
     }
    }
    return outzx;
  }
  
  function emsmrefresh() {
     document.getElementById('aemail').href='mailto:?subject=Cartoon&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19878656) + '&#cartoon=' + encodeURIComponent(document.getElementById('backuptable').outerHTML.replace('<table ','<table class=glow ').replace('display:none;','display:block;')));
     try {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(window.btoa(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     } catch(hgf) {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(encodeURIComponent(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     }
     if (21 == 21) {
     document.getElementById('spancartoon').disabled=false;
     } else {
     document.getElementById('spancartoon').style.display='inline';
     }
     document.getElementById('aemail').style.display='inline';
     //document.getElementById('asms').style.display='inline';
  }
  
  function reverseme(tdo) {
    var thisihis='';
    console.log('here at reverseme');
    if (tdo.outerHTML.indexOf(' class=') == -1) {
    console.log('Here first time at reverseme');
      // trbtd1 vs trtdtd1
      tdo.setAttribute('data-trorig',encodeURIComponent(document.getElementById(tdo.id.replace('tdtd','btd')).innerHTML));
      console.log(tdo.getAttribute('data-trorig'));
    }
    console.log('Here look for class at reverseme');
    //if (tdo.outerHTML.indexOf(' class=\"img_hor') == -1) {
    if (tdo.outerHTML.indexOf('img_hor') == -1) {
    console.log('Here reverse at reverseme');
      if (tdo.outerHTML.indexOf('img_ver') != -1) {
      tdo.style.transform='scaleY(-1) scaleX(-1)';
      } else {
      tdo.style.transform='scaleX(-1)';
      }
      tdo.className=('' + tdo.className).replace(/^null/g,'').replace(/^indefined/g,'') + ' img_hor';
     document.getElementById('aemail').href='mailto:?subject=Cartoon&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19878656) + '&#cartoon=' + encodeURIComponent(document.getElementById('backuptable').outerHTML.replace('<table ','<table class=glow ').replace('display:none;','display:block;')));
     try {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(window.btoa(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     } catch(excv) {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(encodeURIComponent(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     }
     document.getElementById('spancartoon').style.display='inline';
     document.getElementById('aemail').style.display='inline';
     //document.getElementById('asms').style.display='inline';
    } else if (('' + tdo.getAttribute('data-trorig')).replace(/^null/g,'').replace(/^undefined/g,'') != '') {
    console.log('Here reinstate second way at reverseme');
      thisihis=decodeURIComponent('' + tdo.getAttribute('data-trorig'));
      document.getElementById(tdo.id.replace('tdtd','btd')).innerHTML=thisihis;
     document.getElementById('aemail').href='mailto:?subject=Cartoon&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19878656) + '&#cartoon=' + encodeURIComponent(document.getElementById('backuptable').outerHTML.replace('<table ','<table class=glow ').replace('display:none;','display:block;')));
     try {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(window.btoa(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     } catch(excv) {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(encodeURIComponent(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     }
     document.getElementById('spancartoon').style.display='inline';
     document.getElementById('aemail').style.display='inline';
     //document.getElementById('asms').style.display='inline';
    } else {
    console.log('Here reinstate at reverseme');
      tdo.className='imJUNKg_hor';
      tdo.style.transform='scaleX(-1)';
     document.getElementById('aemail').href='mailto:?subject=Cartoon&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19878656) + '&#cartoon=' + encodeURIComponent(document.getElementById('backuptable').outerHTML.replace('<table ','<table class=glow ').replace('display:none;','display:block;')));
     try {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(window.btoa(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     } catch(exvgh) {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(encodeURIComponent(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     }
     document.getElementById('spancartoon').style.display='inline';
     document.getElementById('aemail').style.display='inline';
     //document.getElementById('asms').style.display='inline';
    }
  }
  
  function toppleme(tdo) {
    var thisihis='';
    console.log('here at reverseme');
    if (tdo.outerHTML.indexOf(' class=') == -1) {
    console.log('Here first time at topplememe');
      // trbtd1 vs trtdtd1
      tdo.setAttribute('data-trorig',encodeURIComponent(document.getElementById(tdo.id.replace('tdtd','btd')).innerHTML));
      console.log(tdo.getAttribute('data-trorig'));
    }
    console.log('Here look for class at topplememe');
    //if (tdo.outerHTML.indexOf(' class=\"img_ver') == -1) {
    if (tdo.outerHTML.indexOf('img_ver') == -1) {
    console.log('Here reverse at topplememe');
      if (tdo.outerHTML.indexOf('img_hor') != -1) {
      tdo.style.transform='scaleX(-1) scaleY(-1)';
      } else {
      tdo.style.transform='scaleY(-1)';
      }
      tdo.className=('' + tdo.className).replace(/^null/g,'').replace(/^indefined/g,'') + ' img_ver';
     document.getElementById('aemail').href='mailto:?subject=Cartoon&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19878656) + '&#cartoon=' + encodeURIComponent(document.getElementById('backuptable').outerHTML.replace('<table ','<table class=glow ').replace('display:none;','display:block;')));
     try {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(window.btoa(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     } catch(excv) {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(encodeURIComponent(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     }
     document.getElementById('spancartoon').style.display='inline';
     document.getElementById('aemail').style.display='inline';
     //document.getElementById('asms').style.display='inline';
    } else if (('' + tdo.getAttribute('data-trorig')).replace(/^null/g,'').replace(/^undefined/g,'') != '') {
    console.log('Here reinstate second way at topplememe');
      thisihis=decodeURIComponent('' + tdo.getAttribute('data-trorig'));
      document.getElementById(tdo.id.replace('tdtd','btd')).innerHTML=thisihis;
     document.getElementById('aemail').href='mailto:?subject=Cartoon&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19878656) + '&#cartoon=' + encodeURIComponent(document.getElementById('backuptable').outerHTML.replace('<table ','<table class=glow ').replace('display:none;','display:block;')));
     try {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(window.btoa(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     } catch(excv) {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(encodeURIComponent(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     }
     document.getElementById('spancartoon').style.display='inline';
     document.getElementById('aemail').style.display='inline';
     //document.getElementById('asms').style.display='inline';
    } else {
    console.log('Here reinstate at toppleme');
      tdo.className='imJUNKg_ver';
      tdo.style.transform='scaleY(-1)';
     document.getElementById('aemail').href='mailto:?subject=Cartoon&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19878656) + '&#cartoon=' + encodeURIComponent(document.getElementById('backuptable').outerHTML.replace('<table ','<table class=glow ').replace('display:none;','display:block;')));
     try {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(window.btoa(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     } catch(excv) {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(encodeURIComponent(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     }
     document.getElementById('spancartoon').style.display='inline';
     document.getElementById('aemail').style.display='inline';
     //document.getElementById('asms').style.display='inline';
    }
  }


  function chkit(iois) {
       aconto = (iois.contentWindow || iois.contentDocument);
       if (aconto != null) {
         if (aconto.document) { aconto = aconto.document; }
       }       
   }
   
   function nocrlf(incx) {
     var outcx=incx;
     while (outcx.indexOf(String.fromCharCode(10)) != -1) {
       outcx=outcx.replace(String.fromCharCode(10), '');
     }
     return outcx;
   }
   
   function brize(infg) {
     var outfg=infg, doit=true, lookforhbit=true, theheadbit='';
     var origlen=eval('' + infg.length);
     var outsare=infg.split(String.fromCharCode(10));
     for (var ij=eval(-1 + outsare.length); ij>=0; ij--) {
        if (doit && outsare[ij].trim() == '') {
          origlen-=eval(1 + eval('' + outsare[ij].length));
          outfg=infg.substring(0,origlen);
        } else {
          doit=false;
          if (lookforhbit && outsare[ij].indexOf(' =') != -1 && outsare[ij].indexOf(' =-') == -1 && outsare[ij].indexOf(' ==' + String.fromCharCode(92)) == -1) {
            lookforhbit=false;
            theheadbit=outfg.split(outsare[ij])[0] + outsare[ij] + String.fromCharCode(10);
          }
        }
     }
     if (theheadbit != '') {
       outfg=outfg.split(theheadbit)[1];
       while (theheadbit.indexOf(String.fromCharCode(10)) != -1) {
         theheadbit=theheadbit.replace(String.fromCharCode(10), '<br>');
       }
     }
     while (outfg.indexOf(String.fromCharCode(10)) != -1) {
       outfg=outfg.replace(String.fromCharCode(10), '<br>');
     }
     if (theheadbit != '') {
       document.getElementById('trthtd' + curcell).innerHTML=theheadbit.replace(/\ /g, '&nbsp;');
     }
     return outfg.replace(/\ /g, '&nbsp;');
   }
   
   function setlen(towhat, withwhat) {
     var newwithwhat=withwhat, onerec='';
     var minmaxlen=0, maxlen=0, irecs=0;
     var recs=withwhat.split(String.fromCharCode(13) + String.fromCharCode(10));
     for (irecs=0; irecs<recs.length; irecs++) {
        if (eval('' + recs[irecs].length) > maxlen) { maxlen=eval('' + recs[irecs].length);  }
        //if (eval('' + rtrim(recs[irecs]).length) > minmaxlen) { minmaxlen=eval('' + rtrim(recs[irecs]).length);  }
     }
     eighty=0;
     if (minmaxlen != 0) { maxlen=minmaxlen; }
     //alert('Maxlen=' + maxlen);
     document.getElementById('maxl').value='' + maxlen;
     newwithwhat='';
     while (eval('' + newwithwhat.length) < maxlen) {
       newwithwhat+=' ';
     }
     onerec=newwithwhat;
     newwithwhat='';
     for (irecs=0; irecs<recs.length; irecs++) {
        if (eval('' + recs[irecs].length) > maxlen) { 
          recs[irecs]=recs[irecs].substring(0,maxlen);
        }
        if (eval('' + recs[irecs].length) < maxlen) { 
          while (eval('' + recs[irecs].length) < maxlen) { 
            recs[irecs]+=' ';
          }
          newwithwhat+=recs[irecs] + String.fromCharCode(13) + String.fromCharCode(10);
        } else {
          newwithwhat+=recs[irecs] + String.fromCharCode(13) + String.fromCharCode(10);
        }
     }
     for (var jj=0; jj<100; jj++) {
        newwithwhat+=onerec + String.fromCharCode(13) + String.fromCharCode(10);
     }
     if (aconto.getElementById('dta')) {
       gnewwithwhat=newwithwhat;
       setTimeout(function(){ aconto.getElementById('dta').innerHTML=''; aconto.getElementById('dta').value=gnewwithwhat; if (document.getElementById('nonct').outerHTML.split('>')[0].indexOf(' open') == -1) { aconto.getElementById('dta').style.display='none'; }  }, 5000);
     }
     if (document.getElementById('outdrawing')) {
       document.getElementById('outdrawing').value=newwithwhat;
     }
     document.getElementById('backuptable').innerHTML=initialtableih;
     curcell=1;
     if (curcell == 1) {
       appendthenfill(encodeURIComponent(newwithwhat));
     }
     document.getElementById('atop').style.display='block';
     setTimeout(function(){ if (document.getElementById('nonct').outerHTML.split('>')[0].indexOf(' open') == -1) { aconto.getElementById('dta').style.display='none'; location.href='#atop'; } paddingtopit(); }, 1000); 
     return newwithwhat;
   }
   
   function reopen() {
       aconto.getElementById('dta').style.display='block';
       document.getElementById('atop').style.display='block';
       document.getElementById('backuptable').style.display='block';
   }
   
   function ourencodeURIComponent(incx) {
      return incx.replace(/\%0A/g,'').replace(/\%20/g,'+');
   }
   
   function appendthenfill(xnewwithwhat) {
     document.getElementById('tr' + currow).innerHTML+=celltemplate.replace(/1/g, '' + eval(1 + curcell));
     document.getElementById('trtdtd' + curcell).innerHTML=brize(decodeURIComponent(xnewwithwhat).replace(/\+/g,' '));
     curcell++;
     if (document.getElementById('spanagif')) {
     document.getElementById('spanagif').innerHTML=document.getElementById('spanagif').innerHTML.replace(/^Last\ /g,'');
     document.getElementById('spanvideo').innerHTML=document.getElementById('spanvideo').innerHTML.replace(/^Last\ /g,'');
     }
     document.getElementById('curc').value='' + curcell;
     document.getElementById('aemail').href='mailto:?subject=Cartoon&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19878656) + '&#cartoon=' + encodeURIComponent(document.getElementById('backuptable').outerHTML.replace('<table ','<table class=glow ').replace('display:none;','display:block;')));
     try {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(window.btoa(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     } catch(excv) {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(encodeURIComponent(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     }
     document.getElementById('spancartoon').style.display='inline';
     document.getElementById('aemail').style.display='inline';
     //document.getElementById('asms').style.display='inline';
     if (document.getElementById('spanagif')) {
     document.getElementById('spanagif').disabled=true;
     document.getElementById('spanvideo').disabled=true;
     }
   }
   
   function fpsit() {
     var xfps=prompt('Please enter your frames per second[, font pointsize] values.', '' + fps.split(',')[0] + ',' + pts.split(',')[0]);
     if (xfps == null) { xfps=''; }
     if (xfps.trim() != '') {
       if (xfps.substring(0,1) >= '0' && xfps.substring(0,1) <= '9') {
         if (xfps.trim().split(',')[0].trim() != '') {
         fps=('' + xfps).trim().split(',')[0];
         document.getElementById('fps').value='' + xfps.trim().split(',')[0];
         }
         if (xfps.trim().indexOf(',') != -1) {
         if (xfps.trim().split(',')[1].trim() != '') {
         pts=xfps.trim().split(',')[1].trim();
         document.getElementById('pts').value='' + pts.trim();
         }
         }
       }
     }
   }

   function setlenthree(towhat, withwhat, three) {
     var newwithwhat=withwhat, onerec='';
     var minmaxlen=0, maxlen=0, irecs=0;
     var recs=[];
     
     if (withwhat.indexOf(String.fromCharCode(13) + String.fromCharCode(10)) != -1) {
       recs=withwhat.split(String.fromCharCode(13) + String.fromCharCode(10));
     } else if (withwhat.indexOf(String.fromCharCode(10) + String.fromCharCode(13)) != -1) {
       recs=withwhat.split(String.fromCharCode(10) + String.fromCharCode(13));
     } else if (withwhat.indexOf(String.fromCharCode(10)) != -1) {
       recs=withwhat.split(String.fromCharCode(10));
     } else if (withwhat.indexOf(String.fromCharCode(13)) != -1) {
       recs=withwhat.split(String.fromCharCode(13));
     } else {
       recs=[withwhat];
     } 
     //alert('' + recs[0].slice(-1).charCodeAt() + ' !' + recs[0] + '!');

     var recsextra=three.split(String.fromCharCode(10));
     for (irecs=0; irecs<recs.length; irecs++) {
        if (eval('' + recs[irecs].length) > maxlen) { maxlen=eval('' + recs[irecs].length);  }
        //if (eval('' + rtrim(recs[irecs]).length) > minmaxlen) { minmaxlen=eval('' + rtrim(recs[irecs]).length);  }
     }
     //alert('minmaxlen=' + minmaxlen + ' and maxlen=' + maxlen);
     if (minmaxlen != 0) { maxlen=minmaxlen; }
     eighty+=64;
     maxlen=eighty;
     document.getElementById('maxl').value='' + maxlen;
     newwithwhat='';
     while (eval('' + newwithwhat.length) < maxlen) {
       newwithwhat+=' ';
     }
     onerec=newwithwhat;
     newwithwhat='';
     for (irecs=0; irecs<recs.length; irecs++) {
        if (eval('' + recs[irecs].length) > maxlen) { 
          recs[irecs]=recs[irecs].substring(0,maxlen);
        }
        if (eval('' + recs[irecs].length) < maxlen) { 
          while (eval('' + recs[irecs].length) < maxlen) { 
            recs[irecs]+=' ';
          }
          if (eval('' + recsextra.length) > irecs) {
          newwithwhat+=recs[irecs] + recsextra[irecs] + String.fromCharCode(13) + String.fromCharCode(10);
          console.log('recS[' + irecs + ']=' + recs[irecs] + recsextra[irecs]);
          } else {
          newwithwhat+=recs[irecs] + String.fromCharCode(13) + String.fromCharCode(10);
          console.log('reCS[' + irecs + ']=' + recs[irecs]);
          }
        } else {
          if (eval('' + recsextra.length) > irecs) {
          newwithwhat+=recs[irecs] + recsextra[irecs] + String.fromCharCode(13) + String.fromCharCode(10);
          console.log('rEcs[' + irecs + ']=' + recs[irecs] + recsextra[irecs]);
          } else {
          newwithwhat+=recs[irecs] + String.fromCharCode(13) + String.fromCharCode(10);
          console.log('REcs[' + irecs + ']=' + recs[irecs]);
          }
        }
     }
     for (var jj=recs.length; jj<eval(recs.length + 100); jj++) {
        if (eval('' + recsextra.length) > jj) {
        newwithwhat+=onerec + recsextra[jj] + String.fromCharCode(13) + String.fromCharCode(10);
        } else {
        newwithwhat+=onerec + String.fromCharCode(13) + String.fromCharCode(10);
        }
     }
     if (aconto.getElementById('dta')) {
       gnewwithwhat=newwithwhat;
       //var woo=window.open('','_blank','top=10,left=10,width=500,height=500');
       //woo.document.write('<p>' + gnewwithwhat + '</p>');
       setTimeout(function(){ aconto.getElementById('dta').innerHTML=''; aconto.getElementById('dta').value=gnewwithwhat;  if (document.getElementById('nonct').outerHTML.split('>')[0].indexOf(' open') == -1) { aconto.getElementById('dta').style.display='none'; } }, 5000);
     } //else {
       //var woo=window.open('','_blank','top=10,left=310,width=500,height=500');
       //woo.document.write('<p>' + newwithwhat + '</p>');
     //}
     if (document.getElementById('outdrawing')) {
       document.getElementById('outdrawing').value=newwithwhat;
     }
     if (curcell == 1) {
       appendthenfill(encodeURIComponent(newwithwhat));
     }
     document.getElementById('atop').style.display='block';
     setTimeout(function(){ if (document.getElementById('nonct').outerHTML.split('>')[0].indexOf(' open') == -1) { aconto.getElementById('dta').style.display='none'; location.href='#atop'; } paddingtopit(); }, 1000); 
     return newwithwhat;
   }
   
   function atobmaybe(incx) {
     //alert(incx);
     if (incx.indexOf('PHR') == 0) {
       return window.atob(incx);
     }
     return incx;
   }
   
   function lhchk() {
     var allowanop=true;
     if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
       allowanop=false;
       try {
       document.getElementById('nonct').open=false;
       document.getElementById('nonct').removeAttribute('open');
       } catch(excsd) {
       document.getElementById('nonct').removeAttribute('open');
       }
       //document.getElementById('atop').style.display='block';
       document.getElementById('backuptable').style.display='block';
     }
     if (('' + document.URL + '#' + decodeURIComponent(decodeURIComponent('' + location.hash))).indexOf('cartoon=') != -1) {
        var wasdih=document.getElementById('divback').innerHTML;
        if (('' + document.URL).indexOf('cartoon=') != -1) {
        document.getElementById('divback').innerHTML=atobmaybe(decodeURIComponent(('' + document.URL).split('cartoon=')[1].replace(/^\=/g,'').split('&')[0].split('#')[0])).replace(/\+/g,' ');
   //alert(document.URL);
        } else {    
        document.getElementById('divback').innerHTML=atobmaybe(decodeURIComponent(('' + '#' + decodeURIComponent(decodeURIComponent('' + location.hash))).split('cartoon=')[1].replace(/^\=/g,'').split('#')[0])).replace(/\+/g,' ');
   //alert((decodeURIComponent(('' + '#' + decodeURIComponent(decodeURIComponent('' + location.hash))).split('cartoon=')[1].replace(/^\=/g,'').split('#')[0])).replace(/\+/g,' '));
        }
        if (document.getElementById('divback').innerHTML.trim() == '') {
          document.getElementById('divback').innerHTML=wasdih;
        } else {
         allowanop=false;
        }
     document.getElementById('aemail').href='mailto:?subject=Cartoon&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19878656) + '&#cartoon=' + encodeURIComponent(document.getElementById('backuptable').outerHTML.replace('<table ','<table class=glow ').replace('display:none;','display:block;')));
     try {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(window.btoa(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     } catch(excv) {
     document.getElementById('asms').href='sms:&body=' + encodeURIComponent(document.URL.replace('http:','https:').split('?')[0].split('#')[0] + '#cartoon=' + ourencodeURIComponent(encodeURIComponent(nocrlf(document.getElementById('backuptable').outerHTML).replace('<table ','<table class=glow ').replace('display:none;','display:block;'))));
     }
     document.getElementById('spancartoon').style.display='inline';
     document.getElementById('aemail').style.display='inline';
     //document.getElementById('asms').style.display='inline';
        location.href='#divback';
     }
     paddingtopit();
     setTimeout(function(){ document.getElementById('backuptable').className='noclass';  }, 7000);
     if (isChromeWB && window.self == window.parent && allowanop) {
     anop(); //speechtotextwo=window.open('https://www.rjmprogramming.com.au/PHP/speech_supervisor.php?mode=3', '_blank', 'top=0,left=' + eval(-300 + screenwidth) + ',width=300,height=500');
     } else {
     document.getElementById('spanspeak').style.display='inline';
     }
   }
   
   function paddingtopit() {
      var maxtwo=0, thistwo=0;
      var thhs=[], tdhs=[], it=0;
      var thdids=[];
      //trthtd1 
      //trtdtd1
      var tds=document.getElementsByTagName('td');
      for (it=0; it<tds.length; it++) {
         if (('' + tds[it].id).indexOf('trtdtd') != -1) {
           if (('' + tds[it].style.paddingTop).replace(/^null/g,'').replace(/^undefined/g,'').trim() != '') {
             tds[it].style.paddingTop='0px';
           }
         }
      }
      for (it=0; it<tds.length; it++) {
         if (('' + tds[it].id).indexOf('trtdtd') != -1) {
           tdhs.push(eval('' + tds[it].getBoundingClientRect().height));
           thdids.push('' + tds[it].id);
         }
      }
      var ths=document.getElementsByTagName('th');
      for (it=0; it<ths.length; it++) {
         if (('' + ths[it].id).indexOf('trthtd') != -1) {
           thhs.push(eval('' + ths[it].getBoundingClientRect().height));
           thistwo=eval(thhs[it] + tdhs[it]);
           if (thistwo > maxtwo) { maxtwo=thistwo; }
         }
      }
      for (it=0; it<tdhs.length; it++) {
           thistwo=eval(thhs[it] + tdhs[it]);
           if (thistwo < maxtwo) {
              document.getElementById(thdids[it]).style.paddingTop='' + eval(maxtwo - thistwo) + 'px';
           }
      }   
   }
   
   function showcartoon() {
        document.getElementById('atop').style.display='block';
        document.getElementById('backuptable').style.display='block';
        location.href='#divback';
   }

function tbg() {
  var ftdelim='';
  var finaltranscript='';
  if (document.getElementById('theblurbgoes').title != '' && 1 == 2) {
   if (document.getElementById('theblurbgoes').value.trim() != '') {
     finaltranscript=document.getElementById('theblurbgoes').value;
     document.getElementById('theblurbgoes').value='';
     if (window.opener) { 
      if (window.opener.document.getElementById('url')) { 
           if (('' + window.opener.document.getElementById('url').innerHTML.trim() + '~').indexOf((finaltranscript + '~')) == -1) {
           if (window.opener.document.getElementById('url').innerHTML != '' && window.opener.document.getElementById('url').innerHTML == top.opener.document.getElementById('url').innerHTML.trim() && finaltranscript.substring(0,1) != ' ') {
           ftdelim=' ';
           }
           console.log('Prehere with ' + finaltranscript);
           window.opener.document.getElementById('url').innerHTML=window.opener.document.getElementById('url').innerHTML + ftdelim + finaltranscript;
           console.log('Posthere with ' + finaltranscript);
           }
      }
     }
   }
   setTimeout(tbg,1000);
  }
}

</script>  
</head><body onload=\" lhchk(); initialtableih=document.getElementById('backuptable').innerHTML;\"><h1 id=myh1>Cow Says ...</h1><h3>RJM Programming - February, 2025 - <span id=spancartoon style=cursor:pointer; title='Show in Cartoon mode' onclick='showcartoon();' disabled>Cartoon&#128172;</span>&nbsp;<span id=spanspeak style=cursor:pointer;display:none; title='Show speaking window' onclick='anop();'>Speak&#128483;</span>&nbsp;<a style=display:none; id=aemail target=top href='mailto:?subject=Cartoon&body='>Email&#128231;</a>&nbsp;&nbsp;<a style=display:none; id=asms target=_top href='sms:&body='>SMS&#128223;</a>" . $moreemojibuttons . "</h3><h4>Thanks to <a target=_blank title='https://pypi.org/project/cowsay/' href='//pypi.org/project/cowsay/'>https://pypi.org/project/cowsay/</a></h4><form onsubmit=\"document.getElementById('myiframe').style.display='block'; return true;\" target=myiframe method=POST action='/cowsay.php'><input type=hidden name=fps id=fps value=2></input><input type=hidden name=pts id=pts value=36></input><input type=hidden name=curc id=curc value=1></input><input type=hidden name=maxl id=maxl value=0></input><sup style=vertical-align:top;>\"</sup><textarea style=\"display:none;font-family:'Courier New',Courier,monospace;\" id=outdrawing name=outdrawing></textarea><textarea placeholder=\"In cartoon section, double click horizontally reverses, and right click vertically topples, and wording above is editable.\" style=\"font-family:'Courier New',Courier,monospace;\" data-id=myta id=url cols=50 rows=5 name=inwords></textarea><sup style=vertical-align:top;>\"</sup>&nbsp;&nbsp;&#128488;&nbsp;<select style=display:inline-block;background-color:lightgreen; name=chr>
<option value='cow'>Cow</option>
<option value='beavis'>Beavis</option>
<option value='cheese'>Cheese</option>
<option value='daemon'>Daemon</option>
<option value='dragon'>Dragon</option>
<option value='fox'>Fox</option>
<option value='ghostbusters'>Ghostbusters</option>
<option value='kitty'>Kitty</option>
<option value='meow'>Meow</option>
<option value='miki'>Miki</option>
<option value='milk'>Milk</option>
<option value='octopus'>Octopus</option>
<option value='pig'>Pig</option>
<option value='stegosaurus'>Stegosaurus</option>
<option value='stimpy'>Stimpy</option>
<option value='trex'>TRex</option>
<option value='turkey'>Turkey</option>
<option value='turtle'>Turtle</option>
<option value='tux'>Tux</option>
   </select><br><br><input type=submit value='Cow Says ...' style=background-color:lightblue;></input>&nbsp;&nbsp;<input type=submit value='Cow Says ... and ...' style=background-color:orange; name=and></input></form><br><br><details onclick=reopen(); id=nonct open><summary id=mysum></summary><iframe onload=chkit(this); name=myiframe id=myiframe frameborder=0 style=display:none;width:100%;height:100%; src='/About_Us.html'></iframe></details><br>
<div id=divback>
<a style=display:none; id=atop href='#myh1'>Back to top ...</a>
<table tabspacing=0 tabpadding=0 id=backuptable style=\"display:" . $maybenone . ";font-family:Courier New,Courier,monospace;font-size:6px;\">
<tbody id=tbod>
<tr id=\"tr1\">" . $celltemplate . "</tr>
</tbody>
</table>
</div>
<iframe style=display:none; id=divif src='/About_Us.html'></iframe>
<div id=divmedia></div>
</body></html>";
?>