<?php
  // convert_wildcard.php
  // RJM Programming 
  // October, 2022
  // Facilitate the equivalent of ImageMagick command line ...
  // convert ./imspec*.*g* -density 56% ./*.jpeg
  
$erroris=" ";
$outeis=".jpeg";
$fspec="";
$ext="";
$width=0;
$height=0;
$iferr="";
$includesare="";
$cr="";
$crd="";
$dcr="";
$div_img="";
$ext="";
$zipfile="";
$ziparr = array();
$ziparrc = array();
$ziparrwh = array();
$quality=-1;
$taberows="";
$chkbox="";
$onl="";
if (function_exists('imagebmp')) {
   $onl=" onload=\"document.getElementById('extsel').innerHTML+='<option value=.bmp>.bmp</option><option value=.BMP>.BMP</option>';\"";
}
if (strpos(strtolower($_SERVER['SERVER_NAME']), 'rjmprogramming.com.au') === false) {
  $chkbox="<br><br>Keep Image Files <input type=checkbox id=delc title='Real web server files left after processing, perhaps lessening need to deploy download click functionalities.'></input>";
}
$filteropt="<br><br><details id=doif><summary>Optional Image Filtering ...</summary><br><select size=20 id=sfilter onchange=zoomsame(this);><option value=''>Image Filter ...</option><option value=' '>Image Filter Ask Arguments ...</option><!--option style=display:none; id=redoopt value=redo>Undo Last ...</option><option value=flip>Flip</option><option value=flipvertical>Flip Vertical</option><option value=fliphorizontal>Flip Horizontal</option><option value=rotation>Rotation</option--><option value=emboss>Emboss</option><option value=negate>Negate</option><option value=edge>Edge</option><option value=negedge>Negedge</option><option value=grayscale>Grayscale</option><option value=gaussianblur>Gaussian Blur</option><option value=selectiveblur>Selective Blur</option><option value=sharpen>Sharpen</option><option value=boxblur>Boxblur</option><option value=colourize>Colourize</option><option value=pixellate>Pixellate</option><option value=smooth>Smooth</option><option value=contrast>Contrast</option><option value=brightness>Brightness</option><option value=sketchy>Sketchy</option><option value=colourizered>Colourize Red</option><option value=colourizegreen>Colourize Green</option><option value=colourizeblue>Colourize Blue</option></select><input type=hidden id=rotation value=0></input><input type=hidden id=trot value=0></input></details>";
$inputask="<br><form onsubmit=\" document.getElementById('mysub').style.cursor='progress'; document.getElementById('sfilter').value='';  if (document.getElementById('delc')) { if (!document.getElementById('delc').checked) {  document.getElementById('mysub').name='delfile'; } } return true;\" method=POST action=./convert_wildcard.php><input type=text style='width:80%;' title='Just quietly, some absolute image URL(s), comma separated, can work too' value='' placeholder='Enter relative image file specification eg. f*.png' name=ispec></input><br><br><div id=dext><input type=text style='width:80%;' placeholder='Enter output relative image file extension [.jpeg]' value='' name=outext id=outext></input></div><br><br>Quality: <input type=number style='display:inline-block;' name=quality value=75 step=1 min=-1 max=100 name=quality title='Jpeg Quality Percentage'></input>%" . $chkbox . $filteropt . "<br><br><input id=mysub type=submit value='Convert Image Format(s)'></input></form>";

 if (isset($_GET['ispec']) && (isset($_GET['outext']) || $outeis != '')) {
    if (isset($_GET['quality'])) {  $quality=explode('.',str_replace('%','',str_replace('+',' ',urldecode($_GET['quality']))))[0];   }
    if (isset($_GET['outext'])) { if (strlen($_GET['outext']) > 0) { $outeis=str_replace('+',' ',urldecode($_GET['outext'])); } }
    ourglob(str_replace('+',' ',urldecode($_GET['ispec'])), $outeis);
 } else if (isset($_POST['ispec']) && (isset($_POST['outext']) || $outeis != '')) {
    if (isset($_POST['quality'])) {  $quality=explode('.',str_replace('%','',str_replace('+',' ',urldecode($_POST['quality']))))[0];   }
    if (isset($_POST['outext'])) {  if (strlen($_POST['outext']) > 0) { $outeis=str_replace('+',' ',urldecode($_POST['outext'])); } }
    ourglob(str_replace('+',' ',urldecode($_POST['ispec'])), $outeis);
 }
 
 function getpostmaybe($argidea, $defidea) {
   $gpidea='';
   if (isset($_GET[$argidea])) {
     $gpidea=str_replace('+',' ',urldecode($_GET[$argidea]));
   } else if (isset($_POST[$argidea])) {
     $gpidea=str_replace('+',' ',urldecode($_POST[$argidea]));
   } else if (isset($_GET['arg'])) {
     $gpidea=str_replace('+',' ',urldecode($_GET['arg']));
   } else if (isset($_POST['arg'])) {
     $gpidea=str_replace('+',' ',urldecode($_POST['arg']));
   } else if (isset($_GET['args'])) {
     $gpidea=str_replace('+',' ',urldecode($_GET['args']));
   } else if (isset($_POST['args'])) {
     $gpidea=str_replace('+',' ',urldecode($_POST['args']));
   }     
   if (trim($gpidea) != '') {
     $clist=explode(',', str_replace(' ','',str_replace('(','',str_replace(')','',str_replace(']','',str_replace('[','',str_replace('array','',$gpidea)))))));
     if (sizeof($clist) == 9) {
      return array([$clist[0], $clist[1], $clist[2]],[$clist[3], $clist[4], $clist[5]],[$clist[6], $clist[7], $clist[8]]);
     } else if (sizeof($clist) == 3 && $argidea == 'arg1') {
      return $clist[0];
     } else if (sizeof($clist) == 3 && $argidea == 'arg2') {
      return $clist[1];
     } else if (sizeof($clist) == 3 && $argidea == 'arg3') {
      return $clist[2];
     } else {
      return intval('' . $gpidea);
     } 
   }
   return $defidea;
 }
 

 function ourfile_get_contents($ourfilename) {
   global $zipfile, $ziparrc, $ziparr, $ext;
   return file_get_contents(str_replace('https:','http:',preg_replace('{^//}','http://',$ourfilename)));
   if (substr(($ourfilename . "     "),0,5) != "data:" && substr((strtolower($ourfilename) . "     "),0,4) != "http") {
     $ourfilename=str_replace("/", substr(DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR,0,1), $ourfilename);
   } else if (substr(($ourfilename . "     "),0,1) == "/" && substr(($ourfilename . "     "),0,2) != "//") {
     $ourfilename=dirname(__FILE__) . DIRECTORY_SEPARATOR . str_replace("/", substr(DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR,0,1), substr($ourfilename,1));
     //file_put_contents('qwe.qwezz', $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;
     //file_put_contents('qwe.qwezzz', $ourfilename);
       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 ourimagecreatefromfile($zfilename) {
    global $div_img, $ext;
      //file_put_contents("qwe.qweaa", $zfilename);
    if (isset($_GET['emboss']) || isset($_POST['emboss'])) {
      //file_put_contents("qwe.qwe", str_replace(' ','+',urldecode($_GET['emboss'])) . str_replace(' ','+',urldecode($_POST['emboss'])) . $zfilename);
      //file_put_contents("qwe.qwex", $_SERVER['HTTP_REFERER']);
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['emboss'])) . str_replace(' ','+',urldecode($_POST['emboss'])) . $zfilename));
      $emboss = getpostmaybe('arg1',array([-2, -1, 0], [-1, 1, 1], [0, 1, 2]));
      //file_put_contents("qwe.qwexx", $_SERVER['HTTP_REFERER']);
     //imageconvolution($jm_php, $emboss, 1, 0);    
      imagefilter($jm_php, IMG_FILTER_EMBOSS);
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      //file_put_contents("qwe.qwez", $_SERVER['HTTP_REFERER']);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
      //file_put_contents("qwe.qwey", "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>");
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    } else if (isset($_GET['edge']) || isset($_POST['edge'])) {
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['edge'])) . str_replace(' ','+',urldecode($_POST['edge'])) . $zfilename));
      $edge_detect = getpostmaybe('arg1',array([-1, -1, -1], [-1, 8, -1], [-1, -1, -1]));
      imageconvolution($jm_php, $edge_detect, 1, 0);
      imageconvolution($jm_php, $edge_detect, 1, 255);
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    } else if (isset($_GET['negedge']) || isset($_POST['negedge'])) {
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['negedge'])) . str_replace(' ','+',urldecode($_POST['negedge'])) . $zfilename));
      $edge_detect = getpostmaybe('arg1',array([-1, -1, -1], [-1, 8, -1], [-1, -1, -1]));
      imageconvolution($jm_php, $edge_detect, 1, 0);
      //imageconvolution($jm_php, $edge_detect, 1, 255);
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    } else if (isset($_GET['sharpen']) || isset($_POST['sharpen'])) {
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['sharpen'])) . str_replace(' ','+',urldecode($_POST['sharpen'])) . $zfilename));
      $sharpen = getpostmaybe('arg1',array([0, -1, 0], [-1, 5, -1], [0, -1, 0]));
      imageconvolution($jm_php, $sharpen, 1, 0);
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    } else if (isset($_GET['boxblur']) || isset($_POST['boxblur'])) {
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['boxblur'])) . str_replace(' ','+',urldecode($_POST['boxblur'])) . $zfilename));
      $box_blur = getpostmaybe('arg1',array([1, 1, 1], [1, 1, 1], [1, 1, 1]));
      imageconvolution($jm_php, $box_blur, 9, 0);    
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    } else if (isset($_GET['grayscale']) || isset($_POST['grayscale'])) {
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['grayscale'])) . str_replace(' ','+',urldecode($_POST['grayscale'])) . $zfilename));
      imagefilter($jm_php, IMG_FILTER_GRAYSCALE);
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    } else if (isset($_GET['gaussianianblur']) || isset($_POST['gaussianblur'])) {
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['gaussianblur'])) . str_replace(' ','+',urldecode($_POST['gaussianblur'])) . $zfilename));
      imagefilter($jm_php, IMG_FILTER_GAUSSIAN_BLUR);
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    } else if (isset($_GET['selectiveblur']) || isset($_POST['selectiveblur'])) {

      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['selectiveblur'])) . str_replace(' ','+',urldecode($_POST['selectiveblur'])) . $zfilename));
      imagefilter($jm_php, IMG_FILTER_SELECTIVE_BLUR);
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
      
            
    } else if (isset($_GET['negate']) || isset($_POST['negate'])) {
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['negate'])) . str_replace(' ','+',urldecode($_POST['negate'])) . $zfilename));
      imagefilter($jm_php, IMG_FILTER_NEGATE);
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    } else if (isset($_GET['colourizered']) || isset($_POST['colourizered']) || isset($_GET['colorizered']) || isset($_POST['colorizered'])) {
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['colourizered'])) . str_replace(' ','+',urldecode($_POST['colourizered'])) . $zfilename));
      imagefilter($jm_php, IMG_FILTER_COLORIZE, getpostmaybe('arg1',rand(0,255)), 0, 0); //, 100);
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    } else if (isset($_GET['colourizegreen']) || isset($_POST['colourizegreen']) || isset($_GET['colorizegreen']) || isset($_POST['colorizegreen'])) {
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['colourizegreen'])) . str_replace(' ','+',urldecode($_POST['colourizegreen'])) . $zfilename));
      imagefilter($jm_php, IMG_FILTER_COLORIZE, 0, getpostmaybe('arg1',rand(0,255)), 0); //, 100);
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    } else if (isset($_GET['colourize']) || isset($_POST['colourize']) || isset($_GET['colorize']) || isset($_POST['colorize'])) {
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['colourize'])) . str_replace(' ','+',urldecode($_POST['colourize'])) . $zfilename));
      imagefilter($jm_php, IMG_FILTER_COLORIZE, getpostmaybe('arg1',rand(0, 255)), getpostmaybe('arg2',rand(0, 255)), getpostmaybe('arg3',rand(0, 255))); //, 100);
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    } else if (isset($_GET['colourizeblue']) || isset($_POST['colourizeblue']) || isset($_GET['colorizeblue']) || isset($_POST['colorizeblue'])) {
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['colourizeblue'])) . str_replace(' ','+',urldecode($_POST['colourizeblue'])) . $zfilename));
      imagefilter($jm_php, IMG_FILTER_COLORIZE, 0, 0, getpostmaybe('arg1',rand(0,255))); //, 100);
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    } else if (isset($_GET['pixellate']) || isset($_POST['pixellate']) || isset($_GET['pixelate']) || isset($_POST['pixelate']))  {
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['pixellate'])) . str_replace(' ','+',urldecode($_POST['pixellate'])) . $zfilename));
      imagefilter($jm_php, IMG_FILTER_PIXELATE, getpostmaybe('arg1',rand(1, 9))); // was 3
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    } else if (isset($_GET['smooth']) || isset($_POST['smooth'])) {
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['smooth'])) . str_replace(' ','+',urldecode($_POST['smooth'])) . $zfilename));
      imagefilter($jm_php, IMG_FILTER_SMOOTH, getpostmaybe('arg1',rand(5, 35)));  // was -1924.124
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    } else if (isset($_GET['contrast']) || isset($_POST['contrast'])) {
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['contrast'])) . str_replace(' ','+',urldecode($_POST['contrast'])) . $zfilename));
      imagefilter($jm_php, IMG_FILTER_CONTRAST, getpostmaybe('arg1',rand(-100, 100))); // was -90
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    } else if (isset($_GET['brightness']) || isset($_POST['brightness'])) {
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['brightness'])) . str_replace(' ','+',urldecode($_POST['brightness'])) . $zfilename));
      imagefilter($jm_php, IMG_FILTER_BRIGHTNESS, getpostmaybe('arg1',rand(-255, 255))); // was 98
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    } else if (isset($_GET['sketchy']) || isset($_POST['sketchy']) || isset($_GET['mean_removal']) || isset($_POST['mean_removal']) || isset($_GET['mean-removal']) || isset($_POST['mean-removal']))  {
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['sketchy'])) . str_replace(' ','+',urldecode($_POST['sketchy'])) . $zfilename));
      imagefilter($jm_php, IMG_FILTER_MEAN_REMOVAL);
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    } else if (isset($_GET['flipvertical']) || isset($_POST['flipvertical'])) {
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['flipvertical'])) . str_replace(' ','+',urldecode($_POST['flipvertical'])) . $zfilename));
      $jm_php=ourImageFlip($jm_php, '1'); //imageflip($jm_php, IMG_FLIP_VERTICAL);
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    } else if (isset($_GET['fliphorizontal']) || isset($_POST['fliphorizontal'])) {
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['fliphorizontal'])) . str_replace(' ','+',urldecode($_POST['fliphorizontal'])) . $zfilename));
      $jm_php=ourImageFlip($jm_php, '2'); //imageflip($jm_php, IMG_FLIP_HORIZONTAL);
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    } else if (isset($_GET['flip']) || isset($_POST['flip'])) {
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['flip'])) . str_replace(' ','+',urldecode($_POST['flip'])) . $zfilename));
      $jm_php=ourImageFlip($jm_php, '3'); //imageflip($jm_php, IMG_FLIP_BOTH);
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      imagejpeg($jm_php, $new_name);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      imagedestroy($jm_php);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    } else if (isset($_GET['rotation']) || isset($_POST['rotation'])) {
      //file_put_contents("qwe.qwe1", $zfilename);
      $jm_php = imagecreatefromstring(ourfile_get_contents(str_replace(' ','+',urldecode($_GET['flip'])) . str_replace(' ','+',urldecode($_POST['flip'])) . $zfilename));
      //file_put_contents("qwe.qwe2", $zfilename);
      if (isset($_GET['rotation'])) {
      $iim_php=imagerotate($jm_php, floatval(trim(str_replace('+',' ',urldecode($_GET['rotation'])))), 0); 
      } else if (isset($_POST['rotation'])) {
      //file_put_contents("qwe.qwe3", '' . (trim(str_replace('+',' ',urldecode($_POST['rotation'])))));
      $iim_php=imagerotate($jm_php, floatval(trim(str_replace('+',' ',urldecode($_POST['rotation'])))), 0); 
      //file_put_contents("qwe.qwe4", '' . floatval(trim(str_replace('+',' ',urldecode($_POST['rotation'])))));
      } else {
      $iim_php=imagerotate($jm_php, 0.0, 0); 
      }
      //file_put_contents("qwe.qwe5", $zfilename);
      return $jm_php; //$new_name = 'anewimage0.jpg'; 
      $nj=0;
      while (file_exists('anewimage' . $nj . '.jpg')) {
        $nj++;
        $new_name = 'anewimage' . $nj . '.jpg';
      }
      //file_put_contents("qwe.qwe6", $zfilename);
      imagejpeg($iim_php, $new_name);
      //file_put_contents("qwe.qwe7", $zfilename);
      $qpzm='data:image/jpeg;base64,' . base64_encode(ourfile_get_contents($new_name));
      //file_put_contents("qwe.qwe8", $zfilename);
      imagedestroy($jm_php);
      imagedestroy($iim_php);
      //file_put_contents("qwe.qwe9", $zfilename);
      unlink($new_name);
      if (strpos($_SERVER['HTTP_REFERER'], "/pdfimageplustext.php") !== false) {
       echo "<!doctype html><html><body onload=\" if (parent.document.getElementById('slideshow')) {   parent.document.getElementById('slideshow').value=parent.undobackup('" . datauriit($qpzm) . "'); parent.forcescale(); }   \"></body></html>";
       exit;
      }      
      return $qpzm;
    }
    return imagecreatefromstring(file_get_contents(str_replace('https:','http:',preg_replace('{^//}','http://',$zfilename)))); // 'data:image/' . substr($ext,1) . ";base64," . base64_encode(ourfile_get_contents($zfilename));
 }
 
 function ourglob($ofwhat, $inext) {
   global $inputask, $erroris, $zipfile, $ziparrwh, $ziparrc, $ziparr, $fspec, $ext, $width, $height, $iferr, $includesare, $cr, $crd, $dcr, $quality, $tablerows;
   $image=null;
   $lastname="";
    //file_put_contents('xpp.xpp', $includesare);
   $concernyourself=0;
   if ($zipfile == "") {
     if ($erroris == "") {
      return glob($ofwhat);
     } else if (strpos(strtolower($ofwhat), 'http') !== false || strpos(strtolower($ofwhat), '//') !== false) {
      $ourfs=explode(',', $ofwhat);
      for ($ijk=0; $ijk<sizeof($ourfs); $ijk++) {
        if (strpos($inputask, "<scr") === false) {
           $inputask.="<br><sc" . "ript type=text/javascript> function onl() {  document.getElementById('deta').innerHTML='+'; document.getElementById('myh1').innerHTML='<input type=button style=display:inline-block; onclick=\"cura=0; checkca();\" title=All value=Downloadable></input> Image Conversions'; } setTimeout(onl, 3000); </scr" . "ipt>";
        }
         $ourfilename=explode('#', explode('?', $ourfs[$ijk])[0])[0];
         $ext="." . explode(".", $ourfilename)[-1 + sizeof(explode(".", $ourfilename))];
        //$new_file=str_replace($ext, strtolower(str_replace('..','.',"." . $inext)), $ourfilename);
        $new_file=basename(str_replace($ext, (str_replace('..','.',"." . $inext)), $ourfilename));
        //echo $ofwhat . "<br>" . $ourfilename . "<br>" . $ext . "<br>" . $inext . "<br>" . $new_file;
        if (file_exists($new_file)) {
          $new_file=basename(str_replace($ext, strtoupper(str_replace('..','.',"." . $inext)), $ourfilename));
        }
        if (file_exists($new_file)) {
          $new_file=basename(str_replace($ext, strtolower(str_replace('..','.',"." . $inext)), $ourfilename));
        }
        if (file_exists($new_file)) {
          $new_file=basename(str_replace($ext, (str_replace('..','.',"." . $inext)), $ourfilename));
          while (file_exists($new_file)) {
            $new_file=basename(str_replace((str_replace('..','.',"." . $inext)), "0" . (str_replace('..','.',"." . $inext)), $new_file));
          }
        }
        array_push($ziparr, $new_file); //$ourfilename);
        //$im_php = imagecreatefromstring(file_get_contents(str_replace('https:','http:',$ourfilename)));
        $im_php = ourimagecreatefromfile($ourfilename);
        $width = imagesx($im_php);
        $height = imagesy($im_php);
        switch (strtolower($inext)) {
    case '.jpg':
    case '.jpeg':
       $image = imagejpeg($im_php, $new_file, $quality);
    break;
    case '.gif':
       $image = imagegif($im_php, $new_file);
    break;
     case '.bmp':
      if (function_exists('imagebmp')) {
       $image = imagebmp($im_php, $new_file, true);
      }
    break;
     case '.png':
       $image = imagepng($im_php, $new_file);
    break;
        }
        imagedestroy($im_php);
        //array_push($ziparrwh, '' . $width . ',' . $height);
        //array_push($ziparrc, file_get_contents($new_file));
        //if (!file_exists($new_file)) { echo "<br>oops RE " . $new_file . "<br>"; }
        $tablerows.="<tr><th><a class=ca title='Click to download " . basename($new_file) . "' target=_blank download=" . basename($new_file) . " href=" . 'data:image/' . str_replace("jpg","jpeg",strtolower(explode(".", $new_file)[-1 + sizeof(explode(".", $new_file))])) . ';base64,' . base64_encode(file_get_contents($new_file)) . ">" . basename($new_file) . "</a></th></tr><tr><td><details open><summary></summary><a title='Click to download " . basename($new_file) . "' target=_blank download=" . basename($new_file) . " href=" . 'data:image/' . str_replace("jpg","jpeg",strtolower(explode(".", $new_file)[-1 + sizeof(explode(".", $new_file))])) . ';base64,' . base64_encode(file_get_contents($new_file)) . "><img style='width:" . $width . "px;height:" . $height . "px;' title='Click to download " . basename($new_file) . "' src=" . 'data:image/' . str_replace("jpg","jpeg",strtolower(explode(".", $new_file)[-1 + sizeof(explode(".", $new_file))])) . ';base64,' . base64_encode(file_get_contents($new_file)) . "></img></a><br>\n</details></td></tr>";
        if (strpos(strtolower($_SERVER['SERVER_NAME']), 'rjmprogramming.com.au') === false) {
        imagedestroy($image);
        if (isset($_GET['delfile']) || isset($_POST['delfile'])) {
        unlink($new_file);
        }
        } else {
        unlink($new_file);
        }
      }
      $zipfile=" ";
      return $ziparr;
     } else {
      foreach (glob($ofwhat) as $ourfilename) { 
        if (strpos($inputask, "<scr") === false) {
           $inputask.="<br><sc" . "ript type=text/javascript> function onl() {  document.getElementById('deta').innerHTML='+'; document.getElementById('myh1').innerHTML='<input type=button style=display:inline-block; onclick=\"cura=0; checkca();\" title=All value=Downloadable></input> Image Conversions'; } setTimeout(onl, 3000); </scr" . "ipt>";
        }
        $ext="." . explode(".", $ourfilename)[-1 + sizeof(explode(".", $ourfilename))];
        //$new_file=str_replace($ext, strtolower(str_replace('..','.',"." . $inext)), $ourfilename);
        $new_file=str_replace($ext, (str_replace('..','.',"." . $inext)), $ourfilename);
        //echo $ofwhat . "<br>" . $ourfilename . "<br>" . $ext . "<br>" . $inext . "<br>" . $new_file;
        if (file_exists($new_file)) {
          $new_file=str_replace($ext, strtoupper(str_replace('..','.',"." . $inext)), $ourfilename);
        }
        if (file_exists($new_file)) {
          $new_file=str_replace($ext, strtolower(str_replace('..','.',"." . $inext)), $ourfilename);
        }
        if (file_exists($new_file)) {
          $new_file=str_replace($ext, (str_replace('..','.',"." . $inext)), $ourfilename);
          while (file_exists($new_file)) {
            $new_file=str_replace((str_replace('..','.',"." . $inext)), "0" . (str_replace('..','.',"." . $inext)), $new_file);
          }
        }
        array_push($ziparr, $new_file); //$ourfilename);
        $im_php = ourimagecreatefromfile($ourfilename);
        $width = imagesx($im_php);
        $height = imagesy($im_php);
        switch (strtolower($inext)) {
    case '.jpg':
    case '.jpeg':
       $image = imagejpeg($im_php, $new_file, $quality);
    break;
    case '.gif':
       $image = imagegif($im_php, $new_file);
    break;
     case '.bmp':
      if (function_exists('imagebmp')) {
       $image = imagebmp($im_php, $new_file, true);
      }
    break;
     case '.png':
       $image = imagepng($im_php, $new_file);
    break;
        }
        imagedestroy($im_php);
        //array_push($ziparrwh, '' . $width . ',' . $height);
        //array_push($ziparrc, file_get_contents($new_file));
        //if (!file_exists($new_file)) { echo "<br>oops RE " . $new_file . "<br>"; }
        $tablerows.="<tr><th><a class=ca title='Click to download " . basename($new_file) . "' target=_blank download=" . basename($new_file) . " href=" . 'data:image/' . str_replace("jpg","jpeg",strtolower(explode(".", $new_file)[-1 + sizeof(explode(".", $new_file))])) . ';base64,' . base64_encode(file_get_contents($new_file)) . ">" . basename($new_file) . "</a></th></tr><tr><td><details open><summary></summary><a title='Click to download " . basename($new_file) . "' target=_blank download=" . basename($new_file) . " href=" . 'data:image/' . str_replace("jpg","jpeg",strtolower(explode(".", $new_file)[-1 + sizeof(explode(".", $new_file))])) . ';base64,' . base64_encode(file_get_contents($new_file)) . "><img style='width:" . $width . "px;height:" . $height . "px;' title='Click to download " . basename($new_file) . "' src=" . 'data:image/' . str_replace("jpg","jpeg",strtolower(explode(".", $new_file)[-1 + sizeof(explode(".", $new_file))])) . ';base64,' . base64_encode(file_get_contents($new_file)) . "></img></a><br>\n</details></td></tr>";
        if (strpos(strtolower($_SERVER['SERVER_NAME']), 'rjmprogramming.com.au') === false) {
        imagedestroy($image);
        if (isset($_GET['delfile']) || isset($_POST['delfile'])) {
        unlink($new_file);
        }
        } else {
        unlink($new_file);
        }
      }
      $zipfile=" ";
      return $ziparr;
     }
   } else {
     $zip = zip_open($zipfile);
     if ($zip) {
      while ($zip_entry = zip_read($zip)) {
       $ourfilename=zip_entry_name($zip_entry);
       if (strpos($includesare, $ourfilename) !== false || $includesare == '') {
       $regexpok=0;
       if (strpos($ourfilename, "_MACOSX/") === false) {
       $regexp="/^[\S]" . str_replace('[\s\S]?','[\s\S]*',str_replace('*','[\s\S]?',str_replace('?',',',str_replace('%',',',str_replace('.','[.]',$ofwhat))))) . "$/";
       $regexpok=preg_match($regexp, explode("/",$ourfilename)[-1 + sizeof(explode("/",$ourfilename))]);
       if ($regexpok !== 0) {
        if ($ext == "") $ext="." . explode(".", $ourfilename)[-1 + sizeof(explode(".", $ourfilename))];
        if ($iferr != "" && strpos($iferr, "&include=&") !== false) {
          $iferr=str_replace("&include=&", "&include=" . urlencode($ourfilename) . "&", $iferr);
          $lastname=$ourfilename;
          $concernyourself++;
          $cr.=$crd . $ourfilename; // . " selected";
          if ($dcr != " ") { $dcr.=$crd . "<a " . $adatam . "onmouseover=\"butwhatif(this,'" . less($ourfilename) . "');\" onclick=\"butwhatif(this,'" . less($ourfilename) . "');\" target=myif href='" . $ourfilename . "'>" . basename($ourfilename) . "</a>"; }
          $crd="\n";
        } else if ($iferr != "" && $concernyourself == 1) {
          $iferr=str_replace("&include=" . urlencode($lastname) . "&", "&include=" . urlencode($lastname . "," . $ourfilename) . "&", $iferr);
          $concernyourself++;
          $cr.=$crd . $ourfilename; // . " selected";
          if ($dcr != " ") { $dcr.=$crd . "<a " . $adatam . "onmouseover=\"butwhatif(this,'" . less($ourfilename) . "');\" onclick=\"butwhatif(this,'" . less($ourfilename) . "');\" target=myif href='" . $ourfilename . "'>" . basename($ourfilename) . "</a>"; }
          $crd="\n";
        } else {
          $cr.=$crd . $ourfilename;
          if ($dcr != " ") { $dcr.=$crd . "<a " . $adatam . "onmouseover=\"butwhatif(this,'" . less($ourfilename) . "');\" onclick=\"butwhatif(this,'" . less($ourfilename) . "');\" target=myif href='" . $ourfilename . "'>" . basename($ourfilename) . "</a>"; }
          $crd="\n";
        }
        array_push($ziparr, $ourfilename);
        $isc=zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
        $im_php = imagecreatefromstring($isc);
        $width = imagesx($im_php);
        $height = imagesy($im_php);
        imagedestroy($im_php);
        array_push($ziparrwh, '' . $width . ',' . $height);
        array_push($ziparrc, $isc);
       }
       }
       } else { // reject this one
       if (strpos($ourfilename, "_MACOSX/") === false) {
       $regexp="/^[\S]" . str_replace('[\s\S]?','[\s\S]*',str_replace('*','[\s\S]?',str_replace('?',',',str_replace('%',',',str_replace('.','[.]',$ofwhat))))) . "$/";
       $regexpok=preg_match($regexp, explode("/",$ourfilename)[-1 + sizeof(explode("/",$ourfilename))]);
       if ($regexpok !== 0) {
          $cr.=$crd . $ourfilename;
          if ($dcr != " ") { $dcr.=$crd . "<a " . $adatam . "onmouseover=\"butwhatif(this,'" . less($ourfilename) . "');\" onclick=\"butwhatif(this,'" . less($ourfilename) . "');\" target=myif href='" . $ourfilename . "'>" . basename($ourfilename) . "</a>"; }
          $crd="\n";
       }
       }
       }
      }
      zip_close($zip);
      $includesare="";
     }
     //echo $zhuha;
     //exit;
     return $ziparr;
   }
 }

echo "<!doctyle html>
<html>
<head>
<title>Image Conversions via PHP GD - RJM Programming - October, 2022</title>
<style>
  th { border-top: 1px dotted red; text-align: left; }
  .ca:visited {  color: pink;  }
</style>
<s" . "cript type=text/javascript>
  var cura=0;
  var aaas=[];
  var aska=false;
  var askastr=';emboss;array([-2, -1, 0], [-1, 1, 1], [0, 1, 2]);brightness;255;contrast;100;smooth;35;pixellate;9;colourize;255,255,255;colourizegreen;255;colourizeblue;255;colourizered;255;boxblur;array([1, 1, 1], [1, 1, 1], [1, 1, 1]);edge;array([-1, -1, -1], [-1, 8, -1], [-1, -1, -1]);negedge;array([-1, -1, -1], [-1, 8, -1], [-1, -1, -1]);sharpen;array([0, -1, 0], [-1, 5, -1], [0, -1, 0]);';

  function checkca() {
    if (aaas.length == 0) { aaas=document.getElementsByTagName('a'); }
    for (var ias=0; ias<aaas.length; ias++) {
      if (('' + aaas[ias].className) == 'ca' && ias == cura) {
        if (cura > 10) { alert(aaas[ias].title); }
        aaas[ias].click();
        cura++;
        setTimeout(checkca, 5000);
      } else if (ias == cura) {
        cura++;
        setTimeout(checkca, 200);
      }
    }
  }

  function closeall() {
    var aas=document.getElementsByTagName('details');
    for (var ias=0; ias<aas.length; ias++) {
      if (('' + aas[ias].id) != 'doif') {
       if (document.getElementById('deta').innerHTML == '+') {
        aas[ias].removeAttribute('open');
        //aas[ias].style.display='none';
       } else {
        aas[ias].setAttribute('open',true);
       }
      }
    }
    if (document.getElementById('deta').innerHTML == '+') {
      document.getElementById('deta').innerHTML='-';
    } else {
      document.getElementById('deta').innerHTML='+';
    }
  }


function zoomsame(tvo) {
  var tv=tvo.value;
  var pa=null;
  if (tv.trim() == '' && ('' + tv.length) != '0') { aska=true; }
  if (tv.trim() != '') {
    tvo.name=tv.trim(); 
    if (aska && askastr.indexOf(';' + tv.trim().toLowerCase() + ';') != -1) {
     pa=prompt('Optionally enter argument(s) for ' + tv.trim(), askastr.split(';' + tv.trim().toLowerCase() + ';')[1].split(';')[0]);
     if (pa != null) {
      if (pa.trim() == '') { pa=null; }
     }
    }
    if (pa != null) {
      if (('' + pa.split(',').length) == '3') {
        document.getElementById('rotation').name='args';
        document.getElementById('rotation').value=pa;
      } else {
        document.getElementById('rotation').name='arg1';
        document.getElementById('rotation').value=pa;
      }
    } else {
      document.getElementById('rotation').name='rotation';
      document.getElementById('rotation').value='' + document.getElementById('trot').value;
    }
    if (tv.trim().toLowerCase() == 'redo') {
    redo();
    }     //alert(11);
    //}
  }
}

function redo() {
}

function postdext() {
   var valis=document.getElementById('outext').value;
   document.getElementById('dext').innerHTML='<select id=outext name=outext>' + document.getElementById('extsel').innerHTML.replace('none','block') + '</select>';
   if (valis.trim() != '') {
      if (document.getElementById('dext').innerHTML.indexOf('>' + ('.' + valis.toLowerCase()).replace('..','.') + '<') != -1) {
       if (document.getElementById('dext').innerHTML.indexOf('>' + ('.' + valis).replace('..','.') + '<') == -1) {
         document.getElementById('outext').innerHTML+='<option value=\"' + ('.' + valis).replace('..','.') + '\">' + ('.' + valis).replace('..','.') + '</option>';
       }
       document.getElementById('outext').value=('.' + valis).replace('..','.');
      }
   } else {
      document.getElementById('outext').value=valis;
   }
}

setTimeout(postdext, 15000);
  
</sc" . "ript>
</head>
<body" . $onl . ">
<h1 id=myh1>Image Conversions</h1>
<h3>RJM Programming <a onclick=closeall(); id=deta style='cursor:pointer;text-decoration:none;'>-</a> October, 2022</h3>
<table>" . $tablerows . "
</table>" . $inputask . "
<select id=extsel style=display:none; id=xxxoutext><option value=''>Enter output relative image file extension [.jpeg]</option><option value=.jpeg>.jpeg</option><option value=.jpg>.jpg</option><option value=.png>.png</option><option value=.gif>.gif</option><option value=.JPEG>.JPEG</option><option value=.JPG>.JPG</option><option value=.PNG>.PNG</option><option value=.GIF>.GIF</option></select>
</body>
</html>";

?>