'; $port=":8888"; $dataize=""; $ib="none"; $cmd=""; $newcmd=""; $baseimage='./luna_upstairs.jpg'; $origbase=dirname(__FILE__) . DIRECTORY_SEPARATOR . basename($baseimage); $overlayimage='./luna_backagain.png'; $origoverlay=dirname(__FILE__) . DIRECTORY_SEPARATOR . basename($overlayimage); $exceptthat=""; $onl=""; $thissw=""; if (isset($_GET['myinnards'])) { $thissw=str_replace('+',' ',urldecode($_GET['myinnards'])); $thissw=$_GET['myinnards']; if (strpos($thissw, '%') === false && strpos($thissw, '+') !== false) { $thissw=str_replace('+','%20',urlencode($thissw)); } else if (strpos($thissw, '+') !== false) { $thissw=str_replace('+','%20',urlencode($thissw)); } else if (strpos($thissw, ' ') !== false) { $thissw=str_replace('+','%20',urlencode($thissw)); } } else if (isset($_POST['myinnards'])) { $thissw=str_replace('+',' ',urldecode($_POST['myinnards'])); $thissw=$_POST['myinnards']; if (strpos($thissw, '%') === false && strpos($thissw, '+') !== false) { $thissw=str_replace('+','%20',urlencode($thissw)); } else if (strpos($thissw, ' ') !== false) { $thissw=str_replace('+','%20',urlencode($thissw)); } else if (strpos($thissw, '+') !== false) { $thissw=str_replace('+','%20',urlencode($thissw)); } } if (isset($_GET['hidelocal'])) { $ib="none"; $dataize="data-"; } else if (isset($_GET['showlocal'])) { $ib="inline-block"; $dataize="data-"; if (substr((str_replace('+',' ',urldecode($_GET['showlocal'])) . ':'),0,1) == ':') { $port=str_replace('+',' ',urldecode($_GET['showlocal'])); $locbit=""; } else { $locbit=""; } } if (strpos($_SERVER['SERVER_NAME'], 'localhost') !== false) { $dataize='data-'; $ib="none"; } file_put_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . "speech_bubble_overlays.json", "{\n\"productName\": \"Super Widget\",\n\"price\": 19.99,\n\"inStock\": true,\n\"colors\": [\"red\", \"blue\", \"green\"]}"); file_put_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . "speech_bubble_overlays.js", " function okaytogo() { } "); if (isset($_GET['callback']) && 3 == 6) { echo file_put_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . "speech_bubble_overlays.json"); exit; } $innards=""; $fgc=""; $ifstuff=""; if (strpos($_SERVER['SERVER_NAME'], 'localhost') !== false) { $ifstuff=''; if (file_exists($origoverlay)) { if (strpos($_SERVER['SERVER_NAME'], 'localhost') === false) { $onl=' parent.document.getElementById("locbutone").style.display="inline-block"; '; } } } else { $innards="$.ajax({ url: \"HTTP://localhost:" . $port . "/speech_bubble_overlays.php\", // The URL of the cross-domain API type: \"GET\", dataType: \"jsonp\", // Specifies that it's a JSONP request jsonp: \"callback\", // The name of the query parameter for the callback function (default is 'callback') jsonpCallback: \"myJsonpCallback\", // The name of the global callback function to be executed data: {}, success: function(data) { // This function is executed when the JSONP response is successfully received and parsed alert(35643); " . str_replace('parent.','',$onl) . " console.log(\"Data received:\", data); // Process the received data here }, error: function(jqXHR, textStatus, errorThrown) { // This function is executed if there's an error during the request alert(5643); //console.error(\"Error:\", textStatus, errorThrown); " . str_replace('parent.','',$onl) . " alert(95643); } }); "; } function somenot($theta) { $wds=explode(' ', $theta); if (sizeof($wds) > 3) { $newta=str_replace($wds[0] . ' ' . $wds[1] . ' ', ' ', $theta); return substr($newta, 0, (strlen($newta) - 1 - strlen($wds[-1 + sizeof($wds)]))); } return $theta; } if (isset($_GET['baseimage']) && isset($_GET['overlayimage'])) { unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'luna_backagain.png'); $baseimage=str_replace('+',' ',urldecode($_GET['baseimage'])); $overlayimage=str_replace('//','/',str_replace('./','/',dirname(__FILE__) . DIRECTORY_SEPARATOR . str_replace('+',' ',urldecode($_GET['overlayimage'])))); $ouroverlayimage=dirname(__FILE__) . DIRECTORY_SEPARATOR . 'luna_backagain.png'; // Thanks to https://github.com/ImageMagick/ImageMagick/discussions/4606 and https://stackoverflow.com/questions/71094480/how-to-execute-multi-line-command-with-shell-exec $cmd = << " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "luna.bad", $cmd))); $sx=shell_exec($cmd); //" /bin/convert " . $overlayimage . " " . $sw . " -alpha off -quality 2400 -colorspace RGB -compose copy_opacity -composite " . $ouroverlayimage . " 2> luna.bad > luna.ok"); if (!file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'luna_backagain.png')) { $exceptthat=" ... but errors above cause the fallback you see above"; //file_put_contents('xx.xx', $sx); $derivedvia=" a Preview inspired Speech Bubble extracted image regarding could not be created via ImageMagick (" . $sx . file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'luna.bad') . ") from "; $ouroverlayimage=$overlayimage; copy($origbase, $origoverlay); $ib.=";background-color:yellow"; $thissw=""; } else { $ouroverlayimage=dirname(__FILE__) . DIRECTORY_SEPARATOR . 'luna_backagain.png'; $derivedvia=" created via ImageMagick from "; } } else if (isset($_POST['baseimage']) && isset($_POST['overlayimage'])) { unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'luna_backagain.png'); $baseimage=str_replace('+',' ',urldecode($_POST['baseimage'])); $overlayimage=str_replace('//','/',str_replace('./','/',dirname(__FILE__) . DIRECTORY_SEPARATOR . str_replace('+',' ',urldecode($_POST['overlayimage'])))); $ouroverlayimage=dirname(__FILE__) . DIRECTORY_SEPARATOR . 'luna_backagain.png'; // Thanks to https://github.com/ImageMagick/ImageMagick/discussions/4606 and https://stackoverflow.com/questions/71094480/how-to-execute-multi-line-command-with-shell-exec $cmd = << " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "luna.bad" . "", $cmd))); $sx=shell_exec($cmd); //" /bin/convert " . $overlayimage . " " . $sw . " -alpha off -quality 2400 -colorspace RGB -compose copy_opacity -composite " . $ouroverlayimage . " 2> luna.bad > luna.ok"); if (!file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'luna_backagain.png')) { $exceptthat=" ... but errors above cause the fallback you see above"; $derivedvia=" a Preview inspired Speech Bubble extracted image regarding could not be created via ImageMagick (" . $sx . file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'luna.bad') . ") from "; $ouroverlayimage=$overlayimage; copy($origbase, $origoverlay); $ib.=";background-color:yellow"; $thissw=""; } else { $ouroverlayimage=dirname(__FILE__) . DIRECTORY_SEPARATOR . 'luna_backagain.png'; $derivedvia=" created via ImageMagick from "; } } else { unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'luna_backagain.png'); $overlayimage=dirname(__FILE__) . DIRECTORY_SEPARATOR . 'luna_backagain-1.jpeg'; $ouroverlayimage=dirname(__FILE__) . DIRECTORY_SEPARATOR . 'luna_backagain.png'; // Thanks to https://github.com/ImageMagick/ImageMagick/discussions/4606 and https://stackoverflow.com/questions/71094480/how-to-execute-multi-line-command-with-shell-exec $cmd = << " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "luna.bad" . "", $cmd))); $sx=shell_exec($cmd); //" /bin/convert " . $overlayimage . " " . $sw . " -alpha off -quality 2400 -colorspace RGB -compose copy_opacity -composite " . $ouroverlayimage . " 2> luna.bad > luna.ok"); //echo $sx; //exit; if (!file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'luna_backagain.png')) { $exceptthat=" ... but errors above cause the fallback you see above"; $derivedvia=" a Preview inspired Speech Bubble extracted image regarding could not be created via ImageMagick (" . $sx . file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'luna.bad') . ") from "; $ouroverlayimage=$overlayimage; copy($origbase, $origoverlay); $ib.=";background-color:yellow"; $thissw=""; } else { $derivedvia=" created via ImageMagick from "; } } echo " ImageMagick Command Line Interfacer - RJM Programming - October, 2025

Preview Default Coloured ImageMagick Speech Bubble Extraction and Background Image Overlay


RJM Programming - October, 2025


Thanks to https://github.com/ImageMagick/ImageMagick/discussions/4606 and https://stackoverflow.com/questions/71094480/how-to-execute-multi-line-command-with-shell-exec 
Overlay image  Base image



" . $locbit . " Base image URL:  
Overlay image URL:  " . $derivedvia . "

ImageMagick Switches (acting on last image above to create middle image above" . $exceptthat . ") ...
" . $ifstuff . "
"; ?>