<?php
 // find_images_via_size.php
 // RJM Programming
 // October, 2019
set_time_limit(2400);

 
if (!function_exists("readline")) {  // thanks to https://stackoverflow.com/questions/23238378/call-to-undefined-function-readline
    function readline($prompt = null) {
        if ($prompt) {
            echo $prompt;
        }
        $fp = fopen("php://stdin","r");
        $line = rtrim(fgets($fp, 1024));
        return $line;
    }
}

if (isset($_GET['iuri'])) {
   $imdata=str_replace('+',' ',urldecode($_GET['iuri']));
   if (strpos(strtolower($imdata), "http") !== false || file_exists(str_replace('+',' ',urldecode($_GET['iuri'])))) {
         $jmdata=file_get_contents($imdata);
         $kmdata='data:image/' . explode('&',explode('#',str_replace('jpg','jpeg',strtolower(explode('.',$imdata)[-1 + sizeof(explode('.',$imdata))])))[0])[0] . ';base64,' . base64_encode($jmdata);
         echo "<html><head><title>" . $imdata . "</title><script type=text/javascript> </script></head><body onload=\" if (window.parent) { parent.document.body.title='Double click for data URL image embed string';  parent.document.body.ondblclick = function(evt) { parent.woimg('<img src=" . $kmdata . " title=" . $imdata . " alt=" . $imdata . "></img>','" . $imdata . "'); }; } \"><textarea style='text-shadow: 1px 1px 2px #2dff95;width:100%;background:linear-gradient(rgba(255,255,255,0.5),rgba(255,255,255,0.5)),url(" . $imdata . ");background-size:contain;background-repeat:no-repeat;' rows=80 cols=120>&lt;img src=" . $kmdata . " title=" . $imdata . " alt=" . $imdata . "&gt;&lt;/img&gt;</textarea></body></html>";
   }
   exit;
}

function server_remote_addr() {
     $rma = $_SERVER['REMOTE_ADDR'];
    $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
    // you can add different browsers with the same way ..
    if(preg_match('/(chromium)[ \/]([\w.]+)/', $ua))
            $rma = '000000'.$rma;
    elseif(preg_match('/(chrome)[ \/]([\w.]+)/', $ua))
            $rma = '00000'.$rma;
    elseif(preg_match('/(safari)[ \/]([\w.]+)/', $ua))
            $rma = '0000'.$rma;
    elseif(preg_match('/(opera)[ \/]([\w.]+)/', $ua))
            $rma = '000'.$rma;
    elseif(preg_match('/(msie)[ \/]([\w.]+)/', $ua))
            $rma = '00'.$rma;
    elseif(preg_match('/(mozilla)[ \/]([\w.]+)/', $ua))
            $rma = '0'.$rma;
    else
            $rma = '000000000'.$rma;
    return str_replace('.','_',str_replace(":", "_", $rma));
}

$reverse=false;
$filedelim="/";
if (PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows') {
      $filedelim=substr("\\",0,1);
}

  $onebad="youllneverfindthis";
  $twobad="href=./PHP/";
  $threebad="youllneverfindthis";
  $fourbad=">./PHP/";
  $onebadx="youllneverfindthis";
  $twobadx="href=/";
  $threebadx="youllneverfindthis";
  $fourbadx=">/";
  $thash="";
  $fivebad="youllneverfindthis";
  $sixbad="";
  $sevenbad="youllneverfindthis";
  $eightbad="/";


if (isset($_GET['fillps'])) {
  $fps='<input type=hidden name=fillps value=y></input>';
  $oncl=' onclick=" if (window.parent && parent.document.getElementById(' . "'" . 'spreview' . "'" . ')) {  top.document.getElementById(' . "'" . 'iurl' . "'" . ').value=this.getAttribute(' . "'" . 'data-href' . "'" . ').replace(/^[/][/]/g, ' . "'http://'" . ').replace(/^[/]/g, ' . "'http://'" . ' + document.URL.split(' . "'//'" . ')[1].split(' . "'/'" . ')[0] + ' . "'/'" . '); if (top.setjust(null)) {  top.document.getElementById(' . "'" . 'slideshow' . "'" . ').value=this.getAttribute(' . "'" . 'data-href' . "'" . '); } this.target=' . "'" . 'sspreview' . "'" . ';  } else if (window.opener) {  window.opener.top.document.getElementById(' . "'" . 'slideshow' . "'" . ').value=this.href;    } else { top.document.getElementById(' . "'" . 'slideshow' . "'" . ').value=this.href; } "';
  $onclg='fillps=y&';
  $tb="target=sspreview\t";
  $onebad="href=." . DIRECTORY_SEPARATOR;
  $twobad="href=./PHP/";
  $threebad=">." . DIRECTORY_SEPARATOR;
  $fourbad=">./PHP/";
  $onebadx="href=.." . DIRECTORY_SEPARATOR;
  $twobadx="href=/";
  $threebadx=">.." . DIRECTORY_SEPARATOR;
  $fourbadx=">/";
  $thash="data-";
  $fivebad=$_SERVER['DOCUMENT_ROOT'];
  $sixbad="";
  $sevenbad=substr("\\",0,1);
  $eightbad="/";
  $deforder="<option value='0'>Do no previewing of changes</option><option value='-5'>Preview every change for 5 seconds</option>";
  $onclf="<input id=fillps name=fillps type=hidden value=y></input>";
  if ($onl == '') { $onl=' onload="postxit();"';  }
}

if (isset($_GET['curl'])) {
  exec("curl \"" . "http://" . $_SERVER['SERVER_NAME'] . "" . str_replace("~","",str_replace(":443~","",str_replace(":80~","",(":" . $_SERVER['SERVER_PORT'] . "~")))) . "" . str_replace("find_images_via_size.php","",explode("#",explode("?",$_SERVER['REQUEST_URI'])[0])[0]) . "find_images_via_size.php?rand=" . rand(0,198767543) . "&commandline=" . urlencode(str_replace("+"," ",urldecode($_GET['curl']))) . "\""); 
  echo "<!doctype html><html><head><title>Find Images Via Size - RJM Programming - October, 2019</title><meta charset='utf-8'></head><body onload='postxit();'><div>Find&emsp;Images&emsp;Via&emsp;Size<br><br>RJM&emsp;Programming&emsp;-&emsp;October,&emsp;2019<br><br><br>Width&emsp;x&emsp;Height&emsp;File<br>" . str_replace(" ","&emsp;",str_replace("\n","<br>", file_get_contents("find_images_via_size" . server_remote_addr() . ".txt"))) . "</div><iframe id=iuri style=display:none; src=></iframe></body></html>";
  exit;
}

if (isset($_GET['commandline'])) {
  $gcl=str_replace("+"," ",urldecode($_GET['commandline']));
  if (!isset($argc)) {
  if (strpos($gcl, "\t") !== false) {
  $argv=explode("\t", "file_images_via_size.php\t" . $gcl);
  $argc=sizeof($argv);
  for ($ii=0; $ii<$argc; $ii++) {
    $argv[$ii]=trim($argv[$ii]);
  }
  valit('','');
  }
  }
}

$tablep="";
$tables="";
$postbody="";
$exif="//www.rjmprogramming.com.au/PHP/read_exif_off_image_rotate.php";
$pb="//www.rjmprogramming.com.au/PHP/animegif/tutorial_to_animated_gif.php";
if (PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows') {
$pb=$pb;
} else {
if (strpos($_SERVER['SERVER_NAME'], "rjmprogramming.com.au") === false) {
  if (isset($_GET['filespec'])) {
   if (file_exists("tutorial_to_animated_gif.php")) {
    $pb="./tutorial_to_animated_gif.php";
    $pb=str_replace("/./","/","http://" . $_SERVER['SERVER_NAME'] . "" . str_replace("~","",str_replace(":443~","",str_replace(":80~","",(":" . $_SERVER['SERVER_PORT'] . "~")))) . "" . str_replace("find_images_via_size.php","",explode("#",explode("?",$_SERVER['REQUEST_URI'])[0])[0]) . $pb);
   } else {
    if (file_exists(dirname(__FILE__) . "/" . "find_images_via_size.err")) {
      unlink(dirname(__FILE__) . "/" . "find_images_via_size.err");
    }
    exec("find . -name 'tutorial_to_animated_gif.php' 2>/dev/null | head -1 > " . dirname(__FILE__) . "/" . "find_images_via_size.err");
    if (file_exists(dirname(__FILE__) . "/" . "find_images_via_size.err")) {
      $pb=file_get_contents(dirname(__FILE__) . "/" . "find_images_via_size.err");
      if ($pb == "") {
        $pb="//www.rjmprogramming.com.au/PHP/animegif/tutorial_to_animated_gif.php";
      } else {
        $pb=str_replace("/./","/","http://" . $_SERVER['SERVER_NAME'] . "" . str_replace("~","",str_replace(":443~","",str_replace(":80~","",(":" . $_SERVER['SERVER_PORT'] . "~")))) . "" . str_replace("find_images_via_size.php","",explode("#",explode("?",$_SERVER['REQUEST_URI'])[0])[0]) . $pb);
      }
    }
   } 


   if (file_exists("read_exif_off_image_rotate.php")) {
    $exif="./read_exif_off_image_rotate.php";
    $exif=str_replace("/./","/","http://" . $_SERVER['SERVER_NAME'] . "" . str_replace("~","",str_replace(":443~","",str_replace(":80~","",(":" . $_SERVER['SERVER_PORT'] . "~")))) . "" . str_replace("find_images_via_size.php","",explode("#",explode("?",$_SERVER['REQUEST_URI'])[0])[0]) . $exif);
   } else {
    if (file_exists(dirname(__FILE__) . "/" . "find_images_via_size.err")) {
      unlink(dirname(__FILE__) . "/" . "find_images_via_size.err");
    }
    exec("find . -name 'read_exif_off_image_rotate.php' 2>/dev/null | head -1 > " . dirname(__FILE__) . "/" . "find_images_via_size.err");
    if (file_exists(dirname(__FILE__) . "/" . "find_images_via_size.err")) {
      $exif=file_get_contents(dirname(__FILE__) . "/" . "find_images_via_size.err");
      if ($pb == "") {
        $exif="//www.rjmprogramming.com.au/PHP/read_exif_off_image_rotate.php";
      } else {
        $exif=str_replace("/./","/","http://" . $_SERVER['SERVER_NAME'] . "" . str_replace("~","",str_replace(":443~","",str_replace(":80~","",(":" . $_SERVER['SERVER_PORT'] . "~")))) . "" . str_replace("find_images_via_size.php","",explode("#",explode("?",$_SERVER['REQUEST_URI'])[0])[0]) . $exif);
      }
    }
   } 


  }
}
}
$headscr="<scr" . "ipt type='text/javascript'>
 var aconto=null;
 var unpopsecs=5000;
 var ihelper='';
 var fhelper='';
 var agifs=[];
 var bgifs=[];
 var agifsuff='';
 var validomo=false;
 var pdfpar=false;
 var leftpos=-1, widthv=-1;
 var gscrollTop=0, gscrollLeft=0;
 var bih='';

 function woimg(inig,inname) { 
   var ourwo=window.open('','_blank','top=50,left=50,width=500,height=500'); 
   ourwo.document.write('<html><body><textarea style=\"text-shadow: 1px 1px 2px #2dff95;width:100%;background:linear-gradient(rgba(255,255,255,0.5),rgba(255,255,255,0.5)),url(' + inname + ');background-size:contain;background-repeat:no-repeat;\" rows=80 cols=120>' + inig.replace(/\</g,'&lt;').replace(/\>/g,'&gt;') + '</textarea></body></html>'); 
   ourwo.document.title=inname;  
 } 

 function updatedevery(insv) {
  unpopsecs=eval(1000 * Math.abs(eval(insv)));
 }

 function adjustperhaps(ov) {
  var vhs=[], pcs=[], rect;
  if (('' + ov.id + ' ').toLowerCase().substring(0,1) == 'h') {
    rect=document.body.getBoundingClientRect();
    vhs=('' + ov.value + ' ').toLowerCase().split('v');
    pcs=('' + ov.value + ' ').toLowerCase().split('%');
    if (pcs.length > 1) {
      ov.value='' + Math.round(eval(eval(('' + rect.height)) * eval(('' + pcs[0])) / 100.0));
    } else if (vhs.length > 1) {
      ov.value='' + Math.round(eval(eval(('' + rect.height)) * eval(('' + vhs[0])) / 100.0));
    }
  } else {
    rect=document.body.getBoundingClientRect();
    pcs=('' + ov.value + ' ').toLowerCase().split('%');
    if (pcs.length > 1) {
      ov.value='' + Math.round(eval(eval(('' + rect.width)) * eval(('' + pcs[0])) / 100.0));
    } 
  }
  sett(ov);
 }
 
 function gthen() {
    document.getElementById('myrform').target=vsblank('_blank'); 
    if (document.getElementById('preview')) {
    document.getElementById('preview').style.display='none'; 
    }
 }
 
 function antiomo() {
  if (unpopsecs != 0) { 
    document.getElementById('myrform').target=vsblank('_blank'); 
  }
 }
 
 function omo() {
  if (unpopsecs != 0) { 
    if (bih == '' || bih != document.body.innerHTML) {
    if (document.getElementById('preview')) {
    document.getElementById('preview').style.width='100%'; 
    document.getElementById('preview').style.height='900px'; 
    document.getElementById('preview').style.display='block'; 
    }
    document.getElementById('myrform').target=vsblank('_blank'); 
    if (document.URL.indexOf('fillps=') != -1 && document.getElementById('myrform').innerHTML.indexOf('fillps') == -1) {
      document.getElementById('myrform').innerHTML+='<input name=fillps value=y type=hidden></input>';
    }
    if (validomo) { document.getElementById('myrform').submit(); }
    document.getElementById('myrform').target=vsblank('_blank'); 
    setTimeout(gthen, unpopsecs);
    }
    bih=document.body.innerHTML;
  }  
 }

function scrollxy(idocument) {
        //var idocument=document.getElementById('ijigsaw');
        idocument=document.body;
        var retval='0,0';
        if (gscrollTop != 0 || gscrollLeft != 0) {
            return (gscrollLeft + ',' + gscrollTop);
        } else if (idocument.offsetTop) {
            //document.title=(idocument.offsetLeft + ',' + idocument.offsetTop);
            return (idocument.offsetLeft + ',' + idocument.offsetTop);
        } else if (idocument.scrollTop) {
            //document.title=(idocument.scrollLeft + ',' + idocument.scrollTop);
            return (idocument.scrollLeft + ',' + idocument.scrollTop);
        } else if (idocument.scrollingElement) {
          if (idocument.scrollingElement.scrollTop) {
            //document.title=(idocument.scrollingElement.scrollLeft + ',' + idocument.scrollingElement.scrollTop);
            return (idocument.scrollingElement.scrollLeft + ',' + idocument.scrollingElement.scrollTop);
          }
          if (idocument.documentElement.scrollTop) {
            //document.title=(idocument.documentElement.scrollLeft + ',' + idocument.documentElement.scrollTop);
            return (idocument.documentElement.scrollLeft + ',' + idocument.documentElement.scrollTop);
          }
        }
        //document.title=retval;
        return retval;
}


 function woimg(inig,inname) { 
   var ourwo=window.open('','_blank','top=50,left=50,width=500,height=500'); 
   ourwo.document.write('<html><body><textarea style=\"text-shadow: 1px 1px 2px #2dff95;width:100%;background:linear-gradient(rgba(255,255,255,0.5),rgba(255,255,255,0.5)),url(' + inname + ');background-size:contain;background-repeat:no-repeat;\" rows=80 cols=120>' + inig.replace(/\</g,'&lt;').replace(/\>/g,'&gt;') + '</textarea></body></html>'); 
   ourwo.document.title=inname;  
 } 

 function bdc(thisao) {
   if (('' + thisao.href).replace(/null/g,'').replace(/undefined/g,'').trim() != '') {
     document.getElementById('iuri').src=document.URL.split('?')[0].split('#')[0] + '?iuri=' + encodeURIComponent(thisao.href);
   } else if (('' + thisao.getAttribute('data-href')).replace(/null/g,'').replace(/undefined/g,'').trim() != '') {
     document.getElementById('iuri').src=document.URL.split('?')[0].split('#')[0] + '?iuri=' + encodeURIComponent(thisao.getAttribute('data-href'));
   }
 }

 function toh(ins) {
   if (ins.toLowerCase().indexOf('//') == 0) {
     return 'http:' + ins;
   } else if (ins.toLowerCase().indexOf('http') == 0) {
     return ins;
   } else {
     return document.URL.split('#')[0].split('?')[0].replace('find_images_via_size.php', ins).replace('/./','/');
   }
 }
 
 function gothere(insel) {
  if (insel.value != '') {
  var thisurl='', lookfor='', rects, overrect;
  var hrefs=document.getElementById(insel.id.replace('sel','')).innerHTML.split(' href=');
  if (hrefs.length > 1) {
    if (leftpos < 0) {    overrect=document.body.getBoundingClientRect(); if (document.getElementById('mydetails')) {  document.getElementById('mydetails').setAttribute('open',true);  } rects=document.getElementById('rhth').getBoundingClientRect();   leftpos=Math.floor(8 + eval(eval(('' + rects.left).replace('px','')) + eval(('' + rects.width).replace('px','')))); widthv=eval(('' + overrect.width).replace('px',''));  widthv-=leftpos;   } 
    rects=insel.getBoundingClientRect();
    thisurl=hrefs[1].substring(1).split(hrefs[1].substring(0,1))[0];
    lookfor=thisurl;
      //alert(lookfor + ' via ' + hrefs[1]);
    if (thisurl.indexOf('/../') != -1) { lookfor='/' + thisurl.split('/../')[eval(-1 + thisurl.split('/../').length)]; }
      //alert(lookfor);
    lookfor=lookfor.replace(/\/\.\//g,'/');
      //alert(lookfor);
    while (lookfor.substring(0,1) == '.') {
      lookfor=lookfor.substring(1);
    }
      //alert(lookfor);
    if (insel.value.toLowerCase().indexOf('exif') != -1) {
      //alert('" . $exif . "?image=' + encodeURIComponent(toh(thisurl)));
      document.getElementById('rightif').src='" . $exif . "?image=' + encodeURIComponent(toh(thisurl));
      //document.getElementById('rightif').src='./find_images_via_size.php/?image=' + encodeURIComponent(thisurl);
    //alert(11);
      document.getElementById('rightif').style.position='absolute';     
    //alert(111);
      document.getElementById('rightif').style.width='' + widthv + 'px';     
      document.getElementById('rightif').style.height='100vh';     
      document.getElementById('rightif').style.left='' + leftpos + 'px';     
    //alert(leftpos);
      document.getElementById('rightif').style.top='' + Math.floor(-120 + eval(eval(('' + rects.top).replace('px','')) + eval(scrollxy(insel).split(',')[1].replace('px','')))) + 'px';     
    //alert(document.getElementById('rightif').style.top);
      document.getElementById('rightif').style.display='block';
    //alert(document.getElementById('rightif').outerHTML);
    } else if (insel.value.toLowerCase().indexOf('blog') != -1) {
      //alert(lookfor);
      document.getElementById('rightif').src='//www.rjmprogramming.com.au/ITblog/?s=' + encodeURIComponent(lookfor);
      //document.getElementById('rightif').src='./find_images_via_size.php/?s=' + encodeURIComponent(lookfor);
      document.getElementById('rightif').style.position='absolute';     
      document.getElementById('rightif').style.width='' + widthv + 'px';  
      document.getElementById('rightif').style.height='100vh';     
      document.getElementById('rightif').style.left='' + leftpos + 'px';     
      document.getElementById('rightif').style.top='' + Math.floor(-120 + eval(eval(('' + rects.top).replace('px','')) + eval(scrollxy(insel).split(',')[1].replace('px','')))) + 'px';     
      document.getElementById('rightif').style.display='block';
    } else if (insel.value.toLowerCase().indexOf('fixed') != -1) {
      document.getElementById('rightif').src='//www.rjmprogramming.com.au/PHP/cover_fixed.php?iurl=' + encodeURIComponent(hrefs[1].substring(1).split(hrefs[1].substring(0,1))[0]);
      document.getElementById('rightif').style.position='absolute';     
      document.getElementById('rightif').style.width='' + widthv + 'px';  
      document.getElementById('rightif').style.height='100vh';     
      document.getElementById('rightif').style.left='' + leftpos + 'px';     
      document.getElementById('rightif').style.top='' + Math.floor(-120 + eval(eval(('' + rects.top).replace('px','')) + eval(scrollxy(insel).split(',')[1].replace('px','')))) + 'px';     
      document.getElementById('rightif').style.display='block';
    } else if (insel.value.toLowerCase().indexOf('gif') != -1) {
      document.getElementById(insel.id.replace('selt','wt')).click();
    }
  }
  insel.value='';
  }
 }
 
 function setsel() {
      document.getElementById('gifsel').value='';
      gifpress(document.getElementById('gifsel'));
 }
  
 function gifpress(oselgif) {
   if (oselgif.value != '') {
      var overrect;
      if (leftpos < 0) {  overrect=document.body.getBoundingClientRect(); if (document.getElementById('mydetails')) {  document.getElementById('mydetails').setAttribute('open',true);  } rects=document.getElementById('rhth').getBoundingClientRect();   leftpos=Math.floor(8 + eval(eval(('' + rects.left).replace('px','')) + eval(('' + rects.width).replace('px','')))); widthv=eval(('' + overrect.width).replace('px',''));  widthv-=leftpos;   } 
      document.getElementById('rightif').style.position='absolute';     
      document.getElementById('rightif').style.top='300px';     
      document.getElementById('rightif').style.left='' + leftpos + 'px';     
      document.getElementById('rightif').style.width='' + widthv + 'px';  
      document.getElementById('rightif').style.height='100vh';     
      document.getElementById('rightif').style.display='block';
      for (var ki=0; ki<agifs.length; ki++) {
        eval(agifs[ki]);
      }
      //alert('here, why');
      document.getElementById('olbit').click();
      setTimeout(setsel,30000);
   } else {
      for (var iki=0; iki<bgifs.length; iki++) {
        eval(bgifs[iki]);
      }
      agifs=[];
      bgifs=[];
      ihelper='';
      agifsuff='';
      document.getElementById('mygifform').innerHTML=fhelper;
   }
 }
 
 function vsblank(intar) {
   if (intar == '_blank') {
     if (pdfpar && document.getElementById('spreview')) { document.getElementById('spreview').style.display='block'; document.getElementById('spreview').style.width='100%';  document.getElementById('spreview').style.height='800px';  return 'spreview'; }
   }
   return intar;
 }
 
 function postnopv() {
   if (aconto) {
    aconto.getElementById('supdate').value='0';
   }
 }
 
 function nopv(iois) {
  if (iois != null) {
  if (iois.src.indexOf('find_images_via_size.php') != -1) {
  aconto=null;
  aconto = (iois.contentWindow || iois.contentDocument); 
  if (aconto != null) {
   if (aconto.document) { aconto = aconto.document; }
   if (aconto.body != null) { 
    aconto.getElementById('supdate').value='0';
    setTimeout(postnopv, 5000);
   }
  }
  }
  }
 }
 
 function postpost() {
      //alert(987);
      document.body.innerHTML+='<br><iframe onload=nopv(this); name=spreview id=spreview style=display:none;></iframe><iframe name=sspreview id=sspreview style=display:none;></iframe>';
      //alert(2987);
      document.getElementById('supdate').value='0'; 
      //alert(1987);
      if (document.getElementById('path').value == '.') {
        document.getElementById('path').placeholder='/PHP/';
        document.getElementById('path').value='';
      }
 }
 
 function postxit() {
  //alert(2677);
  if (window.parent) {
  //alert(677);
    if (parent.document.URL.indexOf('/pdfJUNKimageplustext.php') != -1) {
      document.getElementById('myrform').target='_self';
      //alert(56);
      pdfpar=true;
    } else if (parent.document.URL.indexOf('/pdfimageplustext.php') != -1) { // && !document.getElementById('preview')) {
      pdfpar=true;
      setTimeout(postpost, 3000);
    }
  }
 }
 
 function wcc(tdthis,another) {
  var aurl='';
  tdthis.style.backgroundColor='yellow'; 
  if (document.getElementById('gifsel').size == 1) {   
   document.getElementById('gifsel').innerHTML+='<option value=x>Gif Create</option>'; 
   document.getElementById('gifsel').style.backgroundColor='white';
   document.getElementById('gifsel').size='2';  
  }
  document.getElementById('t' + another).style.backgroundColor='yellow';
  if (agifsuff.length == 0) {
    if (fhelper == '') { fhelper=document.getElementById('mygifform').innerHTML; }
    ihelper= document.getElementById('slideshow').outerHTML;
    aurl=document.getElementById('t' + another).innerHTML.split(' href=')[1].substring(1).split(document.getElementById('t' + another).innerHTML.split(' href=')[1].substring(0,1))[0];
    if (aurl.toLowerCase().indexOf('//') == 0) {
    document.getElementById('slideshow').value='http:' + aurl;
    } else if (aurl.toLowerCase().indexOf('http') == 0) {
    document.getElementById('slideshow').value=aurl;
    } else if (aurl.toLowerCase().indexOf('./') == 0) { 
    //document.getElementById('slideshow').value='.' + aurl; //(document.URL.split('find_images_via_size.')[0] + aurl.substring(2)).replace('https:','http:');
    document.getElementById('slideshow').value=(document.URL.split('find_images_via_size.')[0] + aurl.substring(2)).replace('https:','http:');
    } else if (aurl.toLowerCase().indexOf('../') == 0) { 
    //document.getElementById('slideshow').value='../' + aurl; //(document.URL.split('find_images_via_size.')[0] + aurl.substring(2)).replace('https:','http:');
    document.getElementById('slideshow').value=(document.URL.split('find_images_via_size.')[0] + aurl.substring(2)).replace('https:','http:');
    } else {
    document.getElementById('slideshow').value=(document.URL.split('find_images_via_size.')[0] + aurl).replace('/PHP/../','/').replace('https:','http:');
    }
    agifs.push(\"document.getElementById('slideshow').value='\" + document.getElementById('slideshow').value + \"';\");
    bgifs.push(\"document.getElementById('wt\" + another + \"').style.backgroundColor='white';\");
    bgifs.push(\"document.getElementById('t\" + another + \"').style.backgroundColor='white';\");
    agifsuff='2';
    document.getElementById('readyfor' + agifsuff).innerHTML=ihelper.replace(/slideshow/g, 'slideshow' + agifsuff) + '<div id=readyfor' + eval(1 + eval('' + agifsuff)) + '></div>';
  } else {
    aurl=document.getElementById('t' + another).innerHTML.split(' href=')[1].substring(1).split(document.getElementById('t' + another).innerHTML.split(' href=')[1].substring(0,1))[0];
    //alert(another + ': ' + agifsuff + '; ' + aurl);
    if (aurl.toLowerCase().indexOf('//') == 0) {
    document.getElementById('slideshow' + agifsuff).value='http:' + aurl;
    } else if (aurl.toLowerCase().indexOf('http') == 0) {
    document.getElementById('slideshow' + agifsuff).value=aurl;
    } else if (aurl.toLowerCase().indexOf('./') == 0) { 
    //document.getElementById('slideshow' + agifsuff).value='.' + aurl; //(document.URL.split('find_images_via_size.')[0] + aurl.substring(2)).replace('https:','http:');
    document.getElementById('slideshow' + agifsuff).value=(document.URL.split('find_images_via_size.')[0] + aurl.substring(2)).replace('https:','http:');
    } else if (aurl.toLowerCase().indexOf('../') == 0) { 
    //document.getElementById('slideshow' + agifsuff).value='../' + aurl; //(document.URL.split('find_images_via_size.')[0] + aurl.substring(2)).replace('https:','http:');
    document.getElementById('slideshow' + agifsuff).value=(document.URL.split('find_images_via_size.')[0] + aurl.substring(2)).replace('https:','http:');
    } else {
    document.getElementById('slideshow' + agifsuff).value=(document.URL.split('find_images_via_size.')[0] + aurl).replace('/PHP/../','/').replace('https:','http:');
    }
    agifs.push(\"document.getElementById('slideshow\" + agifsuff + \"').value='\" + document.getElementById('slideshow' + agifsuff).value + \"';\");
    bgifs.push(\"document.getElementById('wt\" + another + \"').style.backgroundColor='white';\");
    bgifs.push(\"document.getElementById('t\" + another + \"').style.backgroundColor='white';\");
    agifsuff='' + eval(1 + eval('' + agifsuff));
    document.getElementById('readyfor' + agifsuff).innerHTML=ihelper.replace(/slideshow/g, 'slideshow' + agifsuff) + '<div id=readyfor' + eval(1 + eval('' + agifsuff)) + '></div>';
  } 
 }
 
 function xit() {
  var tds=document.getElementsByTagName('td');
  for (var itd=0; itd<tds.length; itd++) {
    if (tds[itd].innerHTML == 'x') {
      tds[itd].innerHTML=\"<select style=width:40px; id=sel\" + tds[eval(3 + itd)].id + \" onchange=gothere(this);><option value=''>x</option><option value=exif>Exif Information</option><option value=blog>Blog Search</option><option value=fixed>Fixed Background</option><option value=gif>Add as Animated GIF Slide</option></select>\";
    }
  }
  //alert(2677);
  if (window.parent) {
  //alert(677);
    if (parent.document.URL.indexOf('/pdfJUNKimageplustext.php') != -1) {
      document.getElementById('myrform').target='_self';
      pdfpar=true;
      //alert(56);
    } else if (parent.document.URL.indexOf('/pdfimageplustext.php') != -1 && !document.getElementById('preview')) {
      document.body.innerHTML+='<br><iframe name=preview id=preview style=display:none;></iframe>';
    }
  }
 }
 
 function vsblank(intar) {
   if (intar == '_blank') {
     if (pdfpar) {  document.getElementById('spreview').style.display='block';  document.getElementById('spreview').style.width='100%';  document.getElementById('spreview').style.height='800px'; return 'spreview'; }
   }
   return intar;
 }
 
 function postpost() {
      //alert(987);
      document.body.innerHTML+='<br><iframe onload=nopv(this); name=spreview id=spreview style=display:none;></iframe><iframe name=sspreview id=sspreview style=display:none;></iframe>';
      //alert(2987);
      document.getElementById('supdate').value='0'; 
      //alert(1987);
      if (document.getElementById('path').value == '.') {
        document.getElementById('path').placeholder='/PHP/';
        document.getElementById('path').value='';
      }
 }
 
 function postxit() {
  //alert(2677);
  if (window.parent) {
  //alert(677);
    if (parent.document.URL.indexOf('/pdfJUNKimageplustext.php') != -1) {
      document.getElementById('myrform').target='_self';
      //alert(56);
      pdfpar=true;
    } else if (parent.document.URL.indexOf('/pdfimageplustext.php') != -1) { // && !document.getElementById('preview')) {
      pdfpar=true;
      setTimeout(postpost, 3000);
    }
  }
 }
 
 function selsett(os) {
 for (var i=0; i<os.length; i++) {
  if (os.options[i].selected) {
   if (os.id == 'wo') {
    os.title=(os.options[i].title.replace(/\ /g,String.fromCharCode(9)) + String.fromCharCode(9) + document.getElementById('wv').value + String.fromCharCode(9)).replace('  ',' ').replace('  ',' ').replace('  ',' ');
   } else if (os.id == 'ho') {
    os.title=(os.options[i].title.replace(/\ /g,String.fromCharCode(9)) + String.fromCharCode(9) + document.getElementById('hv').value + String.fromCharCode(9)).replace('  ',' ').replace('  ',' ').replace('  ',' ');
   } else {
    os.title=os.options[i].title.replace(/\ /g,String.fromCharCode(9));
   }
  }
 }
 //alert(1);
 omo();
 }
 
 function sett(os) {
   if (os.id == 'wv') {
    selsett(document.getElementById('wo'));  
    os.title='';
   } else if (os.id == 'hv') {
    selsett(document.getElementById('ho'));  
    os.title='';
   } else {
    os.title=os.value;
   }
 //alert(11);
   omo();
 }
 
 function shortlist() {
   var ccmd=document.URL.split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 198767543) + '&curl=' + encodeURIComponent('-p') + encodeURIComponent(String.fromCharCode(9)) + encodeURIComponent(document.getElementById('path').title) + encodeURIComponent(String.fromCharCode(9)) + encodeURIComponent('-f') + encodeURIComponent(String.fromCharCode(9)) + encodeURIComponent(document.getElementById('filespec').title);
   var sels=document.getElementsByTagName('select');
   for (var isels=0; isels<sels.length; isels++) {
     if (('' + sels[isels].title) != '') {
      if (sels[isels].title.indexOf(' open ') == -1) {
       ccmd+=encodeURIComponent(String.fromCharCode(9)) + encodeURIComponent(sels[isels].title.replace(\" A \",\"\\tA \").replace(\" D \",\"\\tD \"));
      }
     }
   }
   location.href=ccmd;
 }
 
 function vomo() {
   validomo=true;
 }
 
 setTimeout(vomo, 6000);
 
</scr" . "ipt>";
$isIE=false;
$detpref="<DETAILS\tID=MYDETAILS><SUMMARY></SUMMARY>";
$detsuff="</DETAILS>";
  if (!isset($argc)) {
$arr_browsers = ["MSIE", "Edge"]; // thanks to https://artisansweb.net/detect-browser-php-javascript/
$agent = $_SERVER['HTTP_USER_AGENT'];
foreach ($arr_browsers as $browser) {
 if (strpos($agent, $browser) !== false) {
  $detpref="";
  $detsuff="";
        $isIE=true;
            break;
 }
}
  } else {
  $detpref="";
  $detsuff="";
  }

 $wo="==";
 $wv="500";
 $ho="==";
 $hv="500";
 $p=".";
 $f="*.*g*";
 $ws="";
 $hs="";
 $fs="";

 function valit($inname, $indef) { 
  global $previewif, $scriptis, $detpref, $detsuff, $formis, $onl, $tablep, $tables, $postbody, $reverse, $filedelim, $pb, $wo, $wv, $ho, $hv, $p, $f, $ws, $hs, $fs, $argc, $argv;
  $cmd="php \"" . dirname(__FILE__) . $filedelim . "find_images_via_size.php\"";
  if (!isset($argc)) {
    if (isset($_GET[$inname])) {
      $tablep="<table style=width;100%><tr><td>";
      $tables="</td><td id=tdright><iframe name=gifa style=display:none; id=rightif src=''></iframe></td></tr></table>";
      //$postbody="<form target='gifa' id=mygifform style='display:none;' action='http://localhost:8888/Htdocs/PHP/animegif/tutorial_to_animated_gif.php' method='POST'>
      $postbody="<form target='gifa' id=mygifform style='display:none;' action='" . $pb . "' method='POST'>
        <input type=hidden id=slideshow name=slideshow value=''></input>
        <input type=hidden id=delay name=delay value='400'></input>
        <input type=hidden id=background-color name=backgroundOLDIDEA-color value='white'></input>
        <input type=hidden id=stitle name=stitle value='Animated Gif via Image Slides'></input>
        <input type=hidden id=outfile name=outfilex value='animated_gif_slideshow'></input>
        <div id=readyfor2></div>
        <input id=olbit type=submit value=Submit></input>
        </form>";
      $onl=" onload=xit();";
      if ($formis == "" && $detpref == strtoupper($detpref) && $detpref != "") { $detpref=strtolower($detpref);  $detsuff=strtolower($detsuff);  $formis=str_replace("</summary>", "Image Find Parameters</summary>",$detpref);   if ($scriptis == "") {  $scriptis="<scri" . "pt type='text/javascript'>   </scr" . "ipt><hr>" . strtolower($detsuff);  }  } else { $detpref=""; $detsuff=""; }
      if ($inname == "wo" || $inname == "ho" || $inname == "wsort" || $inname == "hsort" || $inname == "fsort") {
      if ($scriptis == "") {  $scriptis="<scri" . "pt type='text/javascript'>   </scr" . "ipt>" . strtolower($detsuff);  }
      $scriptis=str_replace("</scr", " document.getElementById('" . $inname . "').value='" . str_replace("+"," ",urldecode($_GET[$inname])) . "'; selsett(document.getElementById('" . $inname . "')); </scr", $scriptis);
      return $indef;
      } else if ($inname == "wv" || $inname == "hv") {
      return explode("e",explode("v",explode("%",explode("p",strtolower(str_replace("+"," ",urldecode($_GET[$inname]))))[0])[0])[0])[0];
      } else {
      return str_replace("+"," ",urldecode($_GET[$inname]));
      }
    }
  } else if ($argc < 2) {
      $aline = str_replace("\n","",readline("\n\n\nImage Dimensions Search \nRJM Programming - October, 2019\n\nEnter relative path [" . $p . "] ")); 
      if ($aline == "") { 
        $cmd.=" -p \"" . $p . "\" ";
      } else {
        $cmd.=" -p \"" . $aline . "\" ";
      }

      $aline = str_replace("\n","",readline("Enter file specification [" . $f . "] ")); 
      if ($aline == "") { 
        $cmd.=" -f \"" . $f . "\" ";
      } else {
        $cmd.=" -f \"" . $aline . "\" ";
      }

      $aline = str_replace("\n","",readline(str_replace("[]","[None]","Enter optional file sort [" . $fs . "] or Ascending or Descending "))); 
      if (strtoupper(substr(($aline . " "),0,1)) == "A") { 
        $cmd.=" -fs " . strtoupper(substr(($aline . " "),0,1)) . " ";
      } else if (strtoupper(substr(($aline . " "),0,1)) == "D") {
        $cmd.=" -fs " . strtoupper(substr(($aline . " "),0,1)) . " ";
      }


      $aline = str_replace("\n","",readline(str_replace("[]","[None]","Enter optional width sort [" . $ws . "] or Ascending or Descending "))); 
      if (strtoupper(substr(($aline . " "),0,1)) == "A") { 
        $cmd.=" -ws " . strtoupper(substr(($aline . " "),0,1)) . " ";
      } else if (strtoupper(substr(($aline . " "),0,1)) == "D") {
        $cmd.=" -ws " . strtoupper(substr(($aline . " "),0,1)) . " ";
      }

      $aline = str_replace("\n","",readline(str_replace("[]","[None]","Enter optional height sort [" . $hs . "] or Ascending or Descending "))); 
      if (strtoupper(substr(($aline . " "),0,1)) == "A") { 
        $cmd.=" -hs " . strtoupper(substr(($aline . " "),0,1)) . " ";
      } else if (strtoupper(substr(($aline . " "),0,1)) == "D") {
        $cmd.=" -hs " . strtoupper(substr(($aline . " "),0,1)) . " ";
      }

      $aline = str_replace("\n","",readline("Enter width operator as [" . str_replace("==","=",$wo) . "] or < or > or <= or >= or != ")); 
      if ($aline == "") { 
        $cmd.=" -weq ";
      } else {
        $cmd.=str_replace("="," -weq ", str_replace(">"," -wgt ", str_replace("<"," -wlt ", str_replace(">="," -wge ", str_replace("<="," -wle ", str_replace("!="," -wne ", $aline))))));
      }

      $aline = str_replace("\n","",readline("Enter width value [" . $wv . "] ")); 
      if ($aline == "") { 
        $cmd.=" " . $wv . " ";
      } else {
        $cmd.=" " . $aline . " ";
      }

      $aline = str_replace("\n","",readline("Enter height operator as [" . str_replace("==","=",$ho) . "] or < or > or <= or >= or != ")); 
      if ($aline == "") { 
        $cmd.=" -heq ";
      } else {
        $cmd.=str_replace("="," -heq ", str_replace(">"," -hgt ", str_replace("<"," -hlt ", str_replace(">="," -hge ", str_replace("<="," -hle ", str_replace("!="," -hne ", $aline))))));
      }

      $aline = str_replace("\n","",readline("Enter height value [" . $hv . "] ")); 
      if ($aline == "") { 
        $cmd.=" " . $hv . " ";
      } else {
        $cmd.=" " . $aline . " ";
      }
      
      $cmd=str_replace("  "," ",$cmd);
      //echo $cmd;
      //exit;
      passthru($cmd);
      exit;
  } else if ($inname == '') {
      $lasthw="w";
      for ($i=1; $i<sizeof($argv); $i++) {
        if (substr(($argv[$i] . "  "),0,1) == '-') {
          if (strtolower(substr(substr(($argv[$i] . "  "),1),0,1)) != " ") { $lasthw=strtolower(substr(substr(($argv[$i] . "  "),1),0,1)); }
          if (strtolower($argv[$i]) == "-weq") {
           $wo="==";
          } else if (strtolower($argv[$i]) == "-wne") {
           $wo="!=";
          } else if (strtolower($argv[$i]) == "-wlt") {
           $wo="<";
          } else if (strtolower($argv[$i]) == "-wgt") {
           $wo=">";
          } else if (strtolower($argv[$i]) == "-wle") {
           $wo="<=";
          } else if (strtolower($argv[$i]) == "-wge") {
           $wo=">=";
          } else if (strtolower($argv[$i]) == "-heq") {
           $ho="==";
          } else if (strtolower($argv[$i]) == "-hne") {
           $ho="!=";
          } else if (strtolower($argv[$i]) == "-hlt") {
           $ho="<";
          } else if (strtolower($argv[$i]) == "-hgt") {
           $ho=">";
          } else if (strtolower($argv[$i]) == "-hle") {
           $ho="<=";
          } else if (strtolower($argv[$i]) == "-hge") {
           $ho=">=";
          } else if (strtolower($argv[$i]) == "-fs") {
           $lasthw="1";
           if ($argv[1 + $i] != "") { // && isset($_GET['commandline'])) {
           $fs=strtolower($argv[1 + $i]);
           if (strpos(substr($fs,0,1), "d") !== false || strpos($fs, "-r") !== false) {  $reverse=true; } else { $reverse=false; }
           }
          } else if (strtolower($argv[$i]) == "-ws") {
          file_put_contents("ws.1",$argv[1 + $i]);
           $lasthw="2";
           if ($argv[1 + $i] != "") { // && isset($_GET['commandline'])) {
           $ws=strtolower($argv[1 + $i]);
           file_put_contents("ws.2b",$ws);
           if (strpos(substr($ws,0,1), "d") !== false || strpos($ws, "-r") !== false) {  $reverse=true; } else { $reverse=false; }
           }
          } else if (strtolower($argv[$i]) == "-hs") {
           $lasthw="3";
           if ($argv[1 + $i] != "") { // && isset($_GET['commandline'])) {
           $hs=strtolower($argv[1 + $i]);
           if (strpos(substr($hs,0,1), "d") !== false || strpos($hs, "-r") !== false) {  $reverse=true; } else { $reverse=false; }
           }
         }
        } else if (strtolower(substr(substr(($argv[$i] . "  "),1),0,1)) == " ") {
          $wo=$wo;
        } else if ($lasthw == "h") {
          $hv=$argv[$i];
        } else if ($lasthw == "w") {
          $wv=$argv[$i];
        } else if ($lasthw == "p") {
          $p=$argv[$i];
        } else if ($lasthw == "f") {
          $f=$argv[$i];
        } else if ($lasthw == "1") {
          if (!isset($_GET['commandline']) && !isset($_GET['curl'])) {
          $fs=str_replace("A", " | sort -k 4 ", str_replace("D", " | sort -r -k 4 ", strtoupper($argv[$i])));
          if (strpos($fs, "-r") !== false) { $reverse=true; } else { $reverse=false; }
          } else {
          $fs=strtolower($argv[$i]);
          if (strpos(substr($fs,0,1), "d") !== false) { $reverse=true; } else { $reverse=false; }
          } 
        } else if ($lasthw == "2") {
          //file_put_contents("ws.2a",$argv[$i]);
          if (!isset($_GET['commandline']) && !isset($_GET['curl'])) {
          $ws=str_replace("A", " | sort -k 1 ", str_replace("D", " | sort -r -k 1 ", strtoupper($argv[$i])));
          if (strpos($ws, "-r") !== false) { $reverse=true; } else { $reverse=false; }
          } else {
          $ws=strtolower($argv[$i]);
          //file_put_contents("ws.2",$ws);
          if (strpos(substr($ws,0,1), "d") !== false) { $reverse=true; } else { $reverse=false; }
          } 
        } else if ($lasthw == "3") {
          if (!isset($_GET['commandline']) && !isset($_GET['curl'])) {
          $hs=str_replace("A", " | sort -k 3 ", str_replace("D", " | sort -r -k 3 ", strtoupper($argv[$i])));
          if (strpos($hs, "-r") !== false) { $reverse=true; } else { $reverse=false; }
          } else {
          $hs=strtolower($argv[$i]);
          if (strpos(substr($hs,0,1), "d") !== false) { $reverse=true; } else { $reverse=false; }
          } 
        }
      }
  } else if ($inname == 'wo') {
      return $wo; //str_replace("="," -weq ", str_replace(">"," -wgt ", str_replace("<"," -wlt ", str_replace(">="," -wge ", str_replace("<="," -wle ", str_replace("!="," -wne ", $wo))))));   
  } else if ($inname == 'wv') {
      return $wv; 
  } else if ($inname == 'wsort') {
      return $ws; 
  } else if ($inname == 'ho') {
      return $ho; //str_replace("="," -weq ", str_replace(">"," -wgt ", str_replace("<"," -wlt ", str_replace(">="," -wge ", str_replace("<="," -wle ", str_replace("!="," -wne ", $wo))))));   
  } else if ($inname == 'hv') {
      return $hv; 
  } else if ($inname == 'hsort') {
      return $hs; 
  } else if ($inname == 'fsort') {
      return $fs; 
  } else if ($inname == 'filespec') {
      return $f; 
  } else if ($inname == 'path') {
      return $p; 
  }
  return $indef;
}
 
 if (isset($argc)) {
  if ($argc < 2) {
    valit('wo', '');
    exit;
  } else {
    valit('','');
  }
 }

function huhit($ct) {
  global $oncl, $tb, $thash, $onebad, $twobad, $threebad, $fourbad, $onebadx, $twobadx, $threebadx, $fourbadx, $fivebad, $sixbad, $sevenbad, $eightbad;
  $bits=explode("\n", $ct);
  $retct="";
  for ($ir=0; $ir<sizeof($bits); $ir++) {
    $subbits=explode("<a", $bits[$ir]);
    if (sizeof($subbits) > 1) {
      $subsub=explode("href=", $subbits[1]);
      $retct.=str_replace(str_replace(substr("\\",0,1),"/",$fivebad),$sixbad,str_replace($sevenbad,$eightbad,",'" . $ir . "');\tclass=widthtd\tid=wt". $ir . ">" . $subbits[0] . "</td><TD\tid=t" . $ir . "><a\t" . $tb . "ID=a" . $ir . "\t" . str_replace(" ","\t",$oncl) . "\tonmouseover=\"bdc(this);\tdocument.body.style.background='linear-gradient(rgba(255,255,255,0.8),rgba(255,255,255,0.8)),URL('+this.href+')'+String.fromCharCode(9)+'repeat-y';\"\t" . str_replace(" ","\t",$oncl) . "onmouseout=\"document.body.style.background='';\"\t" . str_replace(" ","\t",str_replace("/./", "/", str_replace("a target", "a\ttarget", str_replace("blank title", "blank\ttitle", str_replace("img style", "img\tstyle", str_replace("; src", ";\tsrc", str_replace("\" ", "\"\t", $subsub[0]))))))) . str_replace($fivebad,$sixbad,str_replace($threebadx,$fourbadx,str_replace($threebad,$fourbad,str_replace($onebadx,$twobadx,str_replace($onebad,$twobad,$thash . "href=" .  str_replace(" ","%20",str_replace("/./", "/", str_replace("a target", "a\ttarget", str_replace("img style", "img\tstyle", str_replace("; src", ";\tsrc", str_replace("blank title", "blank\ttitle", str_replace("\" ", "\"\t", $subsub[1])))))))))))) . "\n"));
      file_put_contents('xx.xx', 'subsub[1]=' . $subsub[1] . "\nsubbits[1]=" . $subbits[1] . "\nretct so far=" . $retct . "\n\n");
    } else {
      $retct.=$bits[$ir] . "\n";
    }
  }
  return str_replace("/home/rjmprogr/","\$HOME/",$retct); //str_replace("/./", "/", str_replace("a target", "a\ttarget", str_replace("blank title", "blank\ttitle", str_replace("\" ", "\"\t", $ct))));
}

function mappath($inp) {
   if (substr(($inp . " "),0,1) == '.') {
     if (PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows') {
      return dirname(__FILE__) . substr("\\",0,1) . $inp;
     } else {
      return dirname(__FILE__) . "/" . $inp;
     }
   }
   return $inp;
}

function overval($aheadof) {
  global $filedelim;
  if (trim($aheadof) != '') {
    if (substr(($aheadof . '  '),0,1) == '/' && substr(($aheadof . '  '),0,2) != '//') { $aheadof=str_replace(DIRECTORY_SEPARATOR . 'PHP' . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, dirname(__FILE__) . DIRECTORY_SEPARATOR) . '' . substr($aheadof,1);  }   
    if (substr($aheadof,-1,1) == $filedelim) { $aheadof=substr($aheadof,0,(-1 + strlen($aheadof)));  }
  }
  return $aheadof;
}
   
       

$sortbit="";
if (isset($_GET['wsort'])) { $sortbit=str_replace("+"," ",urldecode($_GET['wsort'])); } //" | sort ";
if (isset($_GET['hsort'])) { if ($sortbit == "") { $sortbit=str_replace("+"," ",urldecode($_GET['hsort'])); } else { $sortbit.=str_replace("+"," ",urldecode($_GET['hsort']));  } } //" | sort ";
if (isset($_GET['fsort'])) { if ($sortbit == "") { $sortbit=str_replace("+"," ",urldecode($_GET['fsort'])); } else { $sortbit.=str_replace("+"," ",urldecode($_GET['fsort']));  } } //" | sort ";
$scriptis="";
$formis="";
$datais="<tr><th><input title='.' onblur=sett(this); type=text name=path id=path value='" . valit('path','.') . "'></input></th><th><input title='*.*g*' onblur=sett(this); type=text name=filespec id=filespec value='" . valit('filespec','*.*g*') . "'></input></th><th><select id=wo name=wo title=' -weq 500 ' onchange=selsett(this);><option title=' -weq ' value='" . valit('wo','==') . "'>=</option><option title=' -wlt ' value='<'>&lt;</option><option title=' -wgt ' value='>'>&gt;</option><option title=' -wle ' value='<='>&lt;=</option><option title=' -wge ' value='>='>&gt;=</option><option title=' -wne ' value='!='>!=</option></select></th><th><input title='' onblur=adjustperhaps(this); id=wv name=wv value='" . valit('wv','500') . "'></input></th><th><select id=ho name=ho title=' -heq 500 ' onchange=selsett(this);><option title=' -heq ' value='" . valit('ho','==') . "'>=</option><option title=' -hlt ' value='<'>&lt;</option><option title=' -hgt ' value='>'>&gt;</option><option title=' -hle ' value='<='>&lt;=</option><option title=' -hge ' value='>='>&gt;=</option><option title=' -hne ' value='!='>!=</option></select></th><th><input title='' onblur=adjustperhaps(this); id=hv name=hv value='" . valit('hv','500') . "'></input></th></tr>";
$formis.="<form target=_blank id=myrform onsubmit=\"document.getElementById('myh1').style.cursor='progress'; document.getElementById('mysub').style.cursor='progress'; this.style.cursor='progress'; return true;\" method=GET action=./find_images_via_size.php>" . $tablep . "<table id=mytable border=50><tr><th title=' ... relative to " . str_replace("/home/rjmprogr/","\$HOME/",dirname(__FILE__)) . $filedelim . "'>Relative Path</th><th>" . $onclf . "Filespec <select style=display:inline-block; id=fsort name=fsort title='' onchange=selsett(this);><option title='' value='" . valit('fsort','') . "'>Value</option><option title=' -fs A ' value=' | sort -k 4 '>Ascending Value</option><option title=' -fs D ' value=' | sort -r -k 4 '>Descending Value</option></select></th><th>Width Operator</th><th>Width <select style=display:inline-block; id=wsort name=wsort title='' onchange=selsett(this);><option title='' value='" . valit('wsort','') . "'>Value (px)</option><option title=' -ws A ' value=' | sort -n -k 1 '>Ascending Value</option><option title=' -ws D ' value=' | sort -r -n -k 1 '>Descending Value</option></select></th><th>Height Operator</th><th>Height <select style=display:inline-block; id=hsort name=hsort title='' onchange=selsett(this);><option title='' value='" . valit('hsort','') . "'>Value (px)</option><option title=' -hs A ' value=' | sort -n -k 3 '>Ascending Value</option><option title=' -hs D ' value=' | sort -r -n -k 3 '>Descending Value</option></select></th></tr>" . $datais . "</table>" . $tables . "<br><br><input onmouseover=omo(); onclick=antiomo(); style='background-color:yellow;font-size:20px;' id=mysub type=submit value=List>&nbsp;<input style='background-color:orange;font-size:20px;' type=button onclick='shortlist();' value=Short></input></input><input style='position:absolute;top:-200px;left:-200px;' type=text value=''></input>" . $fps . "</form>";
$formis.=$scriptis; 
$htmlis="<!doctype html><html><head>". $headscr ."<title>Find Images Via Size - RJM Programming - October, 2019</title></head><body". $onl . "><h1 id=myh1>Find Images Via Size <a onclick=\"location.href='#mytable';\" style=\"text-decoration:none;cursor:pointer;\">&#11015;</a> RJM Programming - October, 2019 <select id=supdate onchange='updatedevery(this.value);'>" . $deforder . "<option value='1'>Preview every change for 1 second</option><option value='2'>Preview every change for 2 seconds</option><option value='3'>Preview every change for 3 seconds</option><option value='4'>Preview every change for 4 seconds</option><option value='5'>Preview every change for 5 seconds</option><option value='6'>Preview every change for 6 seconds</option><option value='7'>Preview every change for 7 seconds</option><option value='8'>Preview every change for 8 seconds</option><option value='9'>Preview every change for 9 seconds</option><option value='10'>Preview every change for 10 seconds</option><option value='60'>Preview every change for 60 seconds</option></select></h1>" . $formis . "<p></p>" . $postbody . $previewif . "<iframe id=iuri style=display:none; src=></iframe></body></html>";
$lastsed="";
     if (PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows') {
     $lastsed=" | sed 's/\\(\\ \\)\\(\\.[^\\<]*\\)/\\ \\<a target=_blank title=\"" . str_replace("/","\\/",dirname(__FILE__) . substr("\\",0,1)) . "\\2\" href=\"\\2\"\\>\\<img style=height:60px; src=\"\\2\"\\>\\<\\/img\\>\\2\\<\\/a\\>/g' ";
     } else {
     $lastsed=" | sed 's/\\(\\ \\)\\(\\.[^\\<]*\\)/\\ \\<a target=_blank title=\"" . str_replace("/","\\/",dirname(__FILE__) . "/") . "\\2\" href=\"\\2\"\\>\\<img style=height:60px; src=\"\\2\"\\>\\<\\/img\\>\\2\\<\\/a\\>/g' ";
     }

// | sed '/\\\\ \\\\.[^\\\\<]*/s//<a target=_blank title=\"" . dirname(__FILE__) . substr("\\\\",0,1) . "\\\\1\" href=\"\\\\1\">\\\\1</a>/g' 
// | sed '/\\\\(\\\\ \\\\)\\\\(\\\\.[^\\\\<]*\\\\)/s// <a target=_blank title=\"" . dirname(__FILE__) . substr("\\\\",0,1) . "\\\\2\" href=\"\\\\2\"\\\\>\\\\2\\\\<\\\\/a\\\\>/g' 
// ksh -c "echo '123 x 567 ./x.x' | sed '/\\(\\ \\)\\(\\.[^\\<]*\\)/s// <a target=_blank title=\"" . dirname(__FILE__) . substr("\\",0,1) . "\\2\" href=\"\\2\"\\>\\2\\<\\/a\\>/g' "


// JPEG image is 1280w * 800h, 3 color components, 8 bits per sample JPEG process: Baseline 
// googlewifi.png: PNG image data, 2880 x 1800, 8-bit/color RGBA, non-interlaced
 
if (isset($_GET['filespec'])) {
                                        //$cf="find " . (str_replace("+"," ",$_GET['path'])) . " -name '" . str_replace("+"," ",$_GET['filespec']) . "' -exec file {} \; | grep ' image data' | sed 's/JFIF standard 1.01, aspect ratio, //g' | sed 's/\(." . explode(".",str_replace("+"," ",$_GET['filespec']))[1] . "\): .* \([0-9]* x [0-9]*\).*/\\2 \\1/' | awk 'int($1) " . str_replace("+"," ",$_GET['wo']) . " " . str_replace("+"," ",$_GET['wv']) . " && int($3) " . str_replace("+"," ",$_GET['ho']) . " " . str_replace("+"," ",$_GET['hv']) . " {print}' | sed 's/\\(\\ \\)\\(\\.[^\\<]*\\)/\\ \\<a target=_blank title=\"" . str_replace("/","\\/",dirname(__FILE__) . "/") . "\\2\" href=\"\\2\"\\>\\2\\<\\/a\\>/g'";
   //echo 'cd ' . dirname(__FILE__) . '; ' . $cf . '';
   $appbit="";
   $grepv="";
   $cf3="";
     if (7 == 7 || str_replace("+"," ",urldecode($_GET['fsort'])) != "" || str_replace("+"," ",urldecode($_GET['wsort'])) != "" || str_replace("+"," ",urldecode($_GET['hsort'])) != "" || PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows') {
       $huh="";
       $littlehuh="";
       $littlehuhs="";
       
       $aheadof=str_replace("+"," ",urldecode($_GET['path']));
       if ($aheadof == '') { $aheadof='.'; } else if (substr(($aheadof . '  '),0,1) == '/' && substr(($aheadof . '  '),0,2) != '//') { $aheadof=str_replace(DIRECTORY_SEPARATOR . 'PHP' . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, dirname(__FILE__) . DIRECTORY_SEPARATOR) . '' . substr($aheadof,1);  }
       if (substr($aheadof,-1,1) == $filedelim) { $aheadof=substr($aheadof,0,(-1 + strlen($aheadof)));  }
       foreach (glob($aheadof . $filedelim . str_replace("+"," ",urldecode($_GET['filespec']))) as $filename) {
        try {
         list($width, $height, $type, $attr) = getimagesize($filename);
         if ($width != "" && $height != "") {
         // 3200 x 460 <a target=_blank title="/Applications/MAMP/htdocs/./Htdocs/ITblog/wp-content/themes/twentythirteen/images/headers/star.png" href="./Htdocs/ITblog/wp-content/themes/twentythirteen/images/headers/star.png"><img style=height:60px; src="./Htdocs/ITblog/wp-content/themes/twentythirteen/images/headers/star.png"></img>./Htdocs/ITblog/wp-content/themes/twentythirteen/images/headers/star.png</a>
         $yes=false;
         eval("\$yes=(" . $width . " " . str_replace("+"," ",urldecode($_GET['wo'])) . " " . str_replace("+"," ",urldecode($_GET['wv'])) . " && " . $height . " " . str_replace("+"," ",urldecode($_GET['ho'])) . " " . str_replace("+"," ",urldecode($_GET['hv'])) . ");");
         if ($yes) { 
          if (7 == 7 || str_replace("+"," ",urldecode($_GET['fsort'])) != "" || str_replace("+"," ",urldecode($_GET['wsort'])) != "" || str_replace("+"," ",urldecode($_GET['hsort'])) != "" || PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows') {
          if (str_replace("+"," ",urldecode($_GET['fsort'])) != "") {
          if (strpos(str_replace("+"," ",urldecode($_GET['fsort'])), "-r") !== false) { $reverse=true; }
          $huh.=$width . ' x ' . $height . " " . "<a" . $oncl . " target=_blank " . 'title="' . mappath($filename) . "\" href=\"" . $filename . "\"><img style=height:60px; src=\"" . $filename . "\"></img>" . $filename . "</a>\n"; 
          $littlehuh.="<a target=_blank " . 'title="' . mappath($filename) . "\" href=\"" . $filename . "\"><img style=height:60px; src=\"" . $filename . "\"></img>" . $filename . "</a>~~" . $width . ' x ' . $height . " " . "<a target=_blank " . 'title="' . mappath($filename) . "\" href=\"" . $filename . "\"><img style=height:60px; src=\"" . $filename . "\"></img>" . $filename . "</a>\n"; 
          } else if (str_replace("+"," ",urldecode($_GET['hsort'])) != "") {
          if (strpos(str_replace("+"," ",urldecode($_GET['hsort'])), "-r") !== false) { $reverse=true; }
          $huh.=$width . ' x ' . $height . " " . "<a" . $oncl . " target=_blank " . 'title="' . mappath($filename) . "\" href=\"" . $filename . "\"><img style=height:60px; src=\"" . $filename . "\"></img>" . $filename . "</a>\n"; 
          $littlehuh.=str_pad($height,20,"0",STR_PAD_LEFT) . "~~" . $width . ' x ' . $height . " " . "<a target=_blank " . 'title="' . mappath($filename) . "\" href=\"" . $filename . "\"><img style=height:60px; src=\"" . $filename . "\"></img>" . $filename . "</a>\n"; 
          } else if (str_replace("+"," ",urldecode($_GET['wsort'])) != "") {
          if (strpos(str_replace("+"," ",urldecode($_GET['wsort'])), "-r") !== false) { $reverse=true; }
          $huh.=$width . ' x ' . $height . " " . "<a" . $oncl . " target=_blank " . 'title="' . mappath($filename) . "\" href=\"" . $filename . "\"><img style=height:60px; src=\"" . $filename . "\"></img>" . $filename . "</a>\n"; 
          $littlehuh.=str_pad($width,20,"0",STR_PAD_LEFT) . "~~" . $width . ' x ' . $height . " " . "<a target=_blank " . 'title="' . mappath($filename) . "\" href=\"" . $filename . "\"><img style=height:60px; src=\"" . $filename . "\"></img>" . $filename . "</a>\n"; 
          } else {
          $huh.=$width . ' x ' . $height . " " . "<a" . $oncl . " target=_blank " . 'title="' . mappath($filename) . "\" href=\"" . $filename . "\"><img style=height:60px; src=\"" . $filename . "\"></img>" . $filename . "</a>\n"; 
          $littlehuh=$huh;
          }
          } else {
          $huh.=$width . ' x ' . $height . " " . "<a" . $oncl . " target=_blank " . 'title="' . mappath($filename) . "\" href=\"" . $filename . "\"><img style=height:60px; src=\"" . $filename . "\"></img>" . $filename . "</a>\n"; 
          $littlehuh=$huh;
          }
         }
         }
        } catch (Exception $ewe) {
        }
       }
       if ($huh != $littlehuh) {
       file_put_contents(dirname(__FILE__) . $filedelim . "find_images_via_size" . server_remote_addr() . ".ttt", $littlehuh);
       $lines=file(dirname(__FILE__) . $filedelim . "find_images_via_size" . server_remote_addr() . ".ttt");
       if ($reverse) {
       rsort($lines); //, SORT_STRING);
       } else {
       sort($lines); //, SORT_STRING);
       }
       $huh="";
       foreach ($lines as $key => $val) {
           $huh.=str_replace("\n","",explode("~~", $val)[1]) . "\n";
       }
       file_put_contents(dirname(__FILE__) . $filedelim . "find_images_via_size" . server_remote_addr() . ".txt", $huh);
       } else {
       file_put_contents(dirname(__FILE__) . $filedelim . "find_images_via_size" . server_remote_addr() . ".txt", $huh);
       }
       //echo $huh;
       //exit;
                                        //$cf="find " . (str_replace("+"," ",$_GET['path'])) . " -name '" . str_replace("+"," ",$_GET['filespec']) . "' -exec file {} \;  | sed '/\ precision\ [0-9]*\, /s//`/g' | grep ' image data' | sed 's/\(JFIF [^\`]*\)`\([0-9]*\)x\([0-9]*\)/\\2 x \\3/g' | sed 's/\(." . "[^\ ]*" . "\): .* \([0-9]* x [0-9]*\).*/\\2 \\1/' | awk 'int($1) " . str_replace("+"," ",$_GET['wo']) . " " . valit('wv',str_replace("+"," ",$_GET['wv'])) . " && int($3) " . str_replace("+"," ",$_GET['ho']) . " " . valit('hv',str_replace("+"," ",$_GET['hv'])) . " {print}' " . $sortbit . $lastsed . " > " . dirname(__FILE__) . substr("\\",0,1) . "find_images_via_size" . server_remote_addr() . ".txt 2> " . dirname(__FILE__) . substr("\\",0,1) . "find_images_via_size.err";
  //exec('cd ' . dirname(__FILE__) . '; ' . $cf . ''); //find ' . (str_replace("+"," ",$_GET['path'])) . " -name '" . str_replace("+"," ",$_GET['filespec']) . "' -exec file {} \\; | grep ' image data' | sed 's/\\(." . explode(".",str_replace("+"," ",$_GET['filespec']))[1] . "\\): .* \\([0-9]* x [0-9]*\\).*/\\2 \\1/' | awk 'int($1) " . str_replace("+"," ",$_GET['wo']) . " " . str_replace("+"," ",$_GET['wv']) . " && int($3) " . str_replace("+"," ",$_GET['ho']) . " " . str_replace("+"," ",$_GET['hv']) . " {print}' | sed 's/\\(\\ \\)\\(\\.[^\\<]*\\)/\\ \\<a target=_blank title=\"" . str_replace("/","\\/",dirname(__FILE__) . substr("\\",0,1)) . "\\2\" href=\"\\2\"\\>\\2\\<\\/a\\>/g'  > " . dirname(__FILE__) . substr("\\",0,1) . "find_images_via_size" . server_remote_addr() . ".txt 2> " . dirname(__FILE__) . substr("\\",0,1) . "find_images_via_size.err");
     } else {
     //  | sed '/\\\\ \\\\.[^\\\\<]*/s/<a target=_blank title=\"" . dirname(__FILE__) . "/" . "\\\\1\" href=\"\\\\1\">\\\\1</a>/g'
      $cf="";
      if (file_exists(dirname(__FILE__) . "/" . "find_images_via_size" . server_remote_addr() . ".ttt")) {
        unlink(dirname(__FILE__) . "/" . "find_images_via_size" . server_remote_addr() . ".ttt");
      }
      if (file_exists("/usr/bin/rdjpgcom")) {
   $cf3='cat ' . dirname(__FILE__) . "/" . "find_images_via_size" . server_remote_addr() . ".ttt " . $sortbit . $lastsed . " > " . dirname(__FILE__) . "/" . "find_images_via_size" . server_remote_addr() . ".txt";
   $appbit=">";
   $grepv=" | grep -v 'JPEG image' ";
                                        $cf="find " . (str_replace("+"," ",urldecode($_GET['path']))) . " -name '" . str_replace("+"," ",$_GET['filespec']) . "' -exec echo {}: \; -exec /usr/bin/rdjpgcom -verbose {} \; | egrep -i 'JPEG image|.jp' | tr \"\\n\" \" \" | sed 's/w\ [*]\ / x /g' | sed 's/h[\,]/,/g' | sed 's/image\ is\ /image data, /g' | grep ' image data' | sed 's/\(.[^\ ]*\): .* \([0-9]* x [0-9]*\).*/\\2 \\1/' | awk 'int($1) " . str_replace("+"," ",urldecode($_GET['wo'])) . " " . valit('wv',str_replace("+"," ",$_GET['wv'])) . " && int($3) " . str_replace("+"," ",$_GET['ho']) . " " . valit('hv',str_replace("+"," ",$_GET['hv'])) . " {print}' | tee " . dirname(__FILE__) . "/" . "find_images_via_size" . server_remote_addr() . ".ttt " . $sortbit . $lastsed . " > " . dirname(__FILE__) . "/" . "find_images_via_size" . server_remote_addr() . ".txt 2> " . dirname(__FILE__) . "/" . "find_images_via_size.err";
      } else if (file_exists("/usr/local/bin/rdjpgcom")) {
   $cf3='cat ' . dirname(__FILE__) . "/" . "find_images_via_size" . server_remote_addr() . ".ttt " . $sortbit . $lastsed . " > " . dirname(__FILE__) . "/" . "find_images_via_size" . server_remote_addr() . ".txt";
   $appbit=">";
   $grepv=" | grep -v 'JPEG image' ";
                                        $cf="find " . (str_replace("+"," ",urldecode($_GET['path']))) . " -name '" . str_replace("+"," ",urldecode($_GET['filespec'])) . "' -exec echo {}: \; -exec /usr/local/bin/rdjpgcom -verbose {} \; | egrep -i 'JPEG image|.jp' | tr \"\\n\" \" \" | sed 's/w\ [*]\ / x /g' | sed 's/h[\,]/,/g' | sed 's/image\ is\ /image data, /g' | grep ' image data' | sed 's/\(.[^\ ]*\): .* \([0-9]* x [0-9]*\).*/\\2 \\1/' | awk 'int($1) " . str_replace("+"," ",urldecode($_GET['wo'])) . " " . valit('wv',str_replace("+"," ",$_GET['wv'])) . " && int($3) " . str_replace("+"," ",urldecode($_GET['ho'])) . " " . valit('hv',str_replace("+"," ",$_GET['hv'])) . " {print}' | tee " . dirname(__FILE__) . "/" . "find_images_via_size" . server_remote_addr() . ".ttt " . $sortbit . $lastsed . " > " . dirname(__FILE__) . "/" . "find_images_via_size" . server_remote_addr() . ".txt 2> " . dirname(__FILE__) . "/" . "find_images_via_size.err";
      }
                                        $cf2="find " . (str_replace("+"," ",urldecode($_GET['path']))) . " -name '" . str_replace("+"," ",urldecode($_GET['filespec'])) . "' -exec file {} \; " . $grepv . " | sed '/\ precision\ [0-9]*\, /s//`/g' | grep ' image data' | sed 's/\(JFIF [^\`]*\)`\([0-9]*\)x\([0-9]*\)/\\2 x \\3/g' | sed 's/\(.[^\ ]*\): .* \([0-9]* x [0-9]*\).*/\\2 \\1/' | awk 'int($1) " . str_replace("+"," ",urldecode($_GET['wo'])) . " " . valit('wv',str_replace("+"," ",$_GET['wv'])) . " && int($3) " . str_replace("+"," ",urldecode($_GET['ho'])) . " " . valit('hv',str_replace("+"," ",$_GET['hv'])) . " {print}' | tee -a " . dirname(__FILE__) . "/" . "find_images_via_size" . server_remote_addr() . ".ttt " . $sortbit . $lastsed . " >" . $appbit . " " . dirname(__FILE__) . "/" . "find_images_via_size" . server_remote_addr() . ".txt 2>" . $appbit . " " . dirname(__FILE__) . "/" . "find_images_via_size.err";
   //echo 'cd ' . dirname(__FILE__) . '; ' . str_replace("<","&lt;",str_replace(">","&gt;",$cf)) . '; ' . str_replace("<","&lt;",str_replace(">","&gt;",$cf2)) . '';
   
   //exit;
   if ($cf != "") {
   exec('cd ' . dirname(__FILE__) . '; ' . $cf .''); //find ' . (str_replace("+"," ",$_GET['path'])) . " -name '" . str_replace("+"," ",$_GET['filespec']) . "' -exec file {} \\; | grep ' image data' | sed 's/JFIF standard 1.01, aspect ratio, //g' | sed 's/\\(." . explode(".",str_replace("+"," ",$_GET['filespec']))[1] . "\\): .* \\([0-9]* x [0-9]*\\).*/\\2 \\1/' | awk 'int($1) " . str_replace("+"," ",$_GET['wo']) . " " . str_replace("+"," ",$_GET['wv']) . " && int($3) " . str_replace("+"," ",$_GET['ho']) . " " . str_replace("+"," ",$_GET['hv']) . " {print}' | sed 's/\\(\\ \\)\\(\\.[^\\<]*\\)/\\ \\<a target=_blank title=\"" . str_replace("/","\\/",dirname(__FILE__) . "/") . "\\2\" href=\"\\2\"\\>\\2\\<\\/a\\>/g'  > " . dirname(__FILE__) . "/" . "find_images_via_size" . server_remote_addr() . ".txt 2> " . dirname(__FILE__) . "/" . "find_images_via_size.err");
      if (!file_exists(dirname(__FILE__) . "/" . "find_images_via_size" . server_remote_addr() . ".ttt")) {
        $cf3="";
        $appbit="";
        $grepv="";
      }
   }
  //passthru("cat find_images_via_size" . server_remote_addr() . ".txt");
  //exit;
   exec('cd ' . dirname(__FILE__) . '; ' . $cf2 .''); //find ' . (str_replace("+"," ",$_GET['path'])) . " -name '" . str_replace("+"," ",$_GET['filespec']) . "' -exec file {} \\; | grep ' image data' | sed 's/JFIF standard 1.01, aspect ratio, //g' | sed 's/\\(." . explode(".",str_replace("+"," ",$_GET['filespec']))[1] . "\\): .* \\([0-9]* x [0-9]*\\).*/\\2 \\1/' | awk 'int($1) " . str_replace("+"," ",$_GET['wo']) . " " . str_replace("+"," ",$_GET['wv']) . " && int($3) " . str_replace("+"," ",$_GET['ho']) . " " . str_replace("+"," ",$_GET['hv']) . " {print}' | sed 's/\\(\\ \\)\\(\\.[^\\<]*\\)/\\ \\<a target=_blank title=\"" . str_replace("/","\\/",dirname(__FILE__) . "/") . "\\2\" href=\"\\2\"\\>\\2\\<\\/a\\>/g'  > " . dirname(__FILE__) . "/" . "find_images_via_size" . server_remote_addr() . ".txt 2> " . dirname(__FILE__) . "/" . "find_images_via_size.err");
   if ($sortbit != "" && $lastsed != "" && $appbit != "" && $cf3 != "") {
      exec('cd ' . dirname(__FILE__) . '; ' . $cf3 . ''); 
   }
     }
  // //passthru("find " . str_replace("+"," ",$_GET['path']) . " -name '" . str_replace("+"," ",$_GET['filespec']) . "' -exec file {} \; | sed 's/\(." . explode(".",str_replace("+"," ",$_GET['filespec']))[1] . "\): .* \([0-9]* x [0-9]*\).*/\2 \1/' | awk 'int($1) " . str_replace("+"," ",$_GET['wo']) . " " . str_replace("+"," ",$_GET['wv']) . " && int($3) " . str_replace("+"," ",$_GET['ho']) . " " . str_replace("+"," ",$_GET['hv']) . " {print}'");
  if (isset($argc)) {
  echo file_get_contents("find_images_via_size" . server_remote_addr() . ".txt");
  } else {
  echo explode("</p>", $htmlis)[0] . str_replace("\t"," ","<table style=width:41%; border=2><tr><th style=text-align:left;width:6%;>Width <select id=gifsel title='Highlight cells in this column for potential animated GIF slides, in which case a new option can be selected here for that purpose' style='display:inline-block; width:80px; background-color:yellow;' size=1 onchange=gifpress(this);><option value=''>(px)</option></select></th><th style=text-align:left;width:3%;></th><th style=text-align:left;width:6%;>Height (px)</th><th style=text-align:left;width:1%;></th><th id=rhth style=text-align:left;width:30%;>Image</th></tr><tr><td\tonclick=wcc(this" . str_replace(" ","</td><td>",str_replace("\n","</TD></tr><tr><td\tonclick=wcc(this",huhit(file_get_contents("find_images_via_size" . server_remote_addr() . ".txt")))) . "</td><td colspan=4></td></tr></table>") . "</p>" . explode("</p>", $htmlis)[1];
  }
  // //echo file_get_contents("find_images_via_size" . server_remote_addr() . ".txt");
} else if (isset($argc)) {
   $appbit="";
   $grepv="";
   $cf3="";
   $reverse=false;
     if (7 == 7) {
       $huh="";
       $littlehuh="";
       //echo valit('path','') . $filedelim . valit('filespec','') . ' ' . "\$yes=(" . $width . " " . $wo . " " . $wv . " && " . $height . " " . $ho . " " . $hv . ");";
       //echo valit('path','') . $filedelim . valit('filespec','') . ' ' . "\$yes=(" . $width . " " . valit('wo','') . " " . valit('wv','') . " && " . $height . " " . valit('ho','') . " " . valit('hv','') . ");";
       //exit;
       foreach (glob(overval(valit('path','') . $filedelim . valit('filespec',''))) as $filename) {
        try {
         list($width, $height, $type, $attr) = getimagesize($filename);
         if ($width != "" && $height != "") {
         // 3200 x 460 <a target=_blank title="/Applications/MAMP/htdocs/./Htdocs/ITblog/wp-content/themes/twentythirteen/images/headers/star.png" href="./Htdocs/ITblog/wp-content/themes/twentythirteen/images/headers/star.png"><img style=height:60px; src="./Htdocs/ITblog/wp-content/themes/twentythirteen/images/headers/star.png"></img>./Htdocs/ITblog/wp-content/themes/twentythirteen/images/headers/star.png</a>
         $yes=false;
         eval("\$yes=(" . $width . " " . valit('wo','') . " " . valit('wv','') . " && " . $height . " " . valit('ho','') . " " . valit('hv','') . ");");
         //echo "\$yes=(" . $width . " " . valit('wo','') . " " . valit('wv','') . " && " . $height . " " . valit('ho','') . " " . valit('hv','') . ");";
         if ($yes) { 
         //echo "yes";
         //exit;
          if (7 == 7) {
          if (valit('fsort','') != "") {
          if (strpos(valit('fsort',''), "-r") !== false || strpos(strtolower(substr(valit('fsort',' '),0,1)), "d") !== false) { $reverse=true; }
          $huh.=$width . ' x ' . $height . " " . $filename . "\n"; //. "<a target=_blank " . 'title="' . mappath($filename) . "\" href=\"" . $filename . "\"><img style=height:60px; src=\"" . $filename . "\"></img>" . $filename . "</a>\n"; 
          //$littlehuh.=$filename."~~" . $width . ' x ' . $height . " " . "<a target=_blank " . 'title="' . mappath($filename) . "\" href=\"" . $filename . "\"><img style=height:60px; src=\"" . $filename . "\"></img>" . $filename . "</a>\n"; 
          $littlehuh.=$filename."~~" . $width . ' x ' . $height . " " . $filename . "\n"; //"<a target=_blank " . 'title="' . mappath($filename) . "\" href=\"" . $filename . "\"><img style=height:60px; src=\"" . $filename . "\"></img>" . $filename . "</a>\n"; 
          } else if (valit('hsort','') != "") {
          if (strpos(valit('hsort',''), "-r") !== false || strpos(strtolower(substr(valit('hsort',' '),0,1)), "d") !== false) { $reverse=true; }
          $huh.=$width . ' x ' . $height . " " . $filename; //"<a target=_blank " . 'title="' . mappath($filename) . "\" href=\"" . $filename . "\"><img style=height:60px; src=\"" . $filename . "\"></img>" . $filename . "</a>\n"; 
          $littlehuh.=str_pad($height,20,"0",STR_PAD_LEFT) . "~~" . $width . ' x ' . $height . " " . $filename . "\n"; //"<a target=_blank " . 'title="' . mappath($filename) . "\" href=\"" . $filename . "\"><img style=height:60px; src=\"" . $filename . "\"></img>" . $filename . "</a>\n"; 
          } else if (valit('wsort','') != "") {
          if (strpos(valit('wsort',''), "-r") !== false || strpos(strtolower(substr(valit('wsort',' '),0,1)), "d") !== false) { $reverse=true; }
          $huh.=$width . ' x ' . $height . " " . $filename . "\n"; //"<a target=_blank " . 'title="' . mappath($filename) . "\" href=\"" . $filename . "\"><img style=height:60px; src=\"" . $filename . "\"></img>" . $filename . "</a>\n"; 
          $littlehuh.=str_pad($width,20,"0",STR_PAD_LEFT) . "~~" . $width . ' x ' . $height . " " . $filename . "\n"; //"<a target=_blank " . 'title="' . mappath($filename) . "\" href=\"" . $filename . "\"><img style=height:60px; src=\"" . $filename . "\"></img>" . $filename . "</a>\n"; 
          } else {
          $huh.=$width . ' x ' . $height . " " . $filename . "\n"; //"<a target=_blank " . 'title="' . mappath($filename) . "\" href=\"" . $filename . "\"><img style=height:60px; src=\"" . $filename . "\"></img>" . $filename . "</a>\n"; 
          $littlehuh=$huh;
          }
          } else {
          $huh.=$width . ' x ' . $height . " " . $filename . "\n"; //"<a target=_blank " . 'title="' . mappath($filename) . "\" href=\"" . $filename . "\"><img style=height:60px; src=\"" . $filename . "\"></img>" . $filename . "</a>\n"; 
          $littlehuh=$huh;
          }
         }
         }
        } catch (Exception $ewe) {
        }
       }
       if ($huh != $littlehuh) {
       if (isset($argc)) {
       file_put_contents(dirname(__FILE__) . $filedelim . "find_images_via_size" . server_remote_addr() . ".ttt", $littlehuh);
       } else {
       file_put_contents(dirname(__FILE__) . $filedelim . "find_images_via_size" . server_remote_addr() . ".ttt", $littlehuh);
       }
       $lines=file(dirname(__FILE__) . $filedelim . "find_images_via_size" . server_remote_addr() . ".ttt");
       if (file_exists(dirname(__FILE__) . $filedelim . "find_images_via_size" . server_remote_addr() . ".ttt")) {
         unlink(dirname(__FILE__) . $filedelim . "find_images_via_size" . server_remote_addr() . ".ttt");
       }
       if ($reverse) {
       rsort($lines); //, SORT_STRING);
       } else {
       sort($lines); //, SORT_STRING);
       }
       $huh="";
       foreach ($lines as $key => $val) {
           $huh.=str_replace("\n","",explode("~~", $val)[1]) . "\n";
       }
       file_put_contents(dirname(__FILE__) . $filedelim . "find_images_via_size" . server_remote_addr() . ".txt", $huh);
       } else {
       file_put_contents(dirname(__FILE__) . $filedelim . "find_images_via_size" . server_remote_addr() . ".txt", $huh);
       }
       //echo $huh;
       //exit;
                                        //$cf="find " . (str_replace("+"," ",$_GET['path'])) . " -name '" . str_replace("+"," ",$_GET['filespec']) . "' -exec file {} \;  | sed '/\ precision\ [0-9]*\, /s//`/g' | grep ' image data' | sed 's/\(JFIF [^\`]*\)`\([0-9]*\)x\([0-9]*\)/\\2 x \\3/g' | sed 's/\(." . "[^\ ]*" . "\): .* \([0-9]* x [0-9]*\).*/\\2 \\1/' | awk 'int($1) " . str_replace("+"," ",$_GET['wo']) . " " . valit('wv',str_replace("+"," ",$_GET['wv'])) . " && int($3) " . str_replace("+"," ",$_GET['ho']) . " " . valit('hv',str_replace("+"," ",$_GET['hv'])) . " {print}' " . $sortbit . $lastsed . " > " . dirname(__FILE__) . substr("\\",0,1) . "find_images_via_size" . server_remote_addr() . ".txt 2> " . dirname(__FILE__) . substr("\\",0,1) . "find_images_via_size.err";
  //exec('cd ' . dirname(__FILE__) . '; ' . $cf . ''); //find ' . (str_replace("+"," ",$_GET['path'])) . " -name '" . str_replace("+"," ",$_GET['filespec']) . "' -exec file {} \\; | grep ' image data' | sed 's/\\(." . explode(".",str_replace("+"," ",$_GET['filespec']))[1] . "\\): .* \\([0-9]* x [0-9]*\\).*/\\2 \\1/' | awk 'int($1) " . str_replace("+"," ",$_GET['wo']) . " " . str_replace("+"," ",$_GET['wv']) . " && int($3) " . str_replace("+"," ",$_GET['ho']) . " " . str_replace("+"," ",$_GET['hv']) . " {print}' | sed 's/\\(\\ \\)\\(\\.[^\\<]*\\)/\\ \\<a target=_blank title=\"" . str_replace("/","\\/",dirname(__FILE__) . substr("\\",0,1)) . "\\2\" href=\"\\2\"\\>\\2\\<\\/a\\>/g'  > " . dirname(__FILE__) . substr("\\",0,1) . "find_images_via_size" . server_remote_addr() . ".txt 2> " . dirname(__FILE__) . substr("\\",0,1) . "find_images_via_size.err");
     }
     if (isset($_GET['commandline'])) {
       echo "<!doctype html><html><head><title>Find Images Via Size - RJM Programming - October, 2019</title><meta charset='utf-8'></head><body onload='postxit();'><div>Find&emsp;Images&emsp;Via&emsp;Size<br><br>RJM&emsp;Programming&emsp;-&emsp;October,&emsp;2019<br><br><br>Width&emsp;x&emsp;Height&emsp;File<br>" . str_replace(" ","&emsp;",str_replace("\n","<br>", file_get_contents("find_images_via_size" . server_remote_addr() . ".txt"))) . "</div>" . $previewif . "<iframe id=iuri style=display:none; src=></iframe></body></html>";
     } else { 
       echo "Find Images Via Size\n\nRJM Programming - October, 2019\n\n\nWidth x Height File\n\n" . file_get_contents("find_images_via_size" . server_remote_addr() . ".txt");
     }
} else {
  echo $htmlis;
}
exit;
