#thone { background:URL(\"d' + document.getElementById('result').innerHTML.substring(1).replace(/data\:/g,'\"),URL(\"data:') + '\"); background-repeat:no-repeat; } #thtwo { background:linear-gradient(rgba(255,255,255,0.3),rgba(255,255,255,0.3)),URL(\"d' + document.getElementById('result').innerHTML.substring(1).replace(/data\:/g,'\"),URL(\"data:') + '\"); background-repeat:repeat; } #hthree { background:linear-gradient(rgba(255,255,255,0.3),rgba(255,255,255,0.3)),URL(\"d' + document.getElementById('result').innerHTML.substring(1).replace(/data\:/g,'\"),URL(\"data:') + '\"); background-size:cover; background-repeat:no-repeat; } #result { background:linear-gradient(rgba(255,255,255,0.3),rgba(255,255,255,0.3)),URL(\"d' + document.getElementById('result').innerHTML.substring(1).replace(/data\:/g,'\"),URL(\"data:') + '\"); background-size:contain; background-repeat:no-repeat; } #borderimg1 { border-image: url(\"d' + document.getElementById('result').innerHTML.substring(1).replace(/data\:/g,'\"),URL(\"data:') + '\") 30%; border-image-repeat: round; } #borderimg2 { border-image: url(\"d' + document.getElementById('result').innerHTML.substring(1).replace(/data\:/g,'\"),URL(\"data:') + '\") 20%; border-image-repeat: stretch; } '; "; $transparent="transparent"; $ei="Emoji Image"; $cr="Creator"; $imgw="image"; $iimage="image"; $iaudio="ywnft"; $ivideo="ywnft"; $gps="window.open(\"https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fwww.rjmprogramming.com.au%2FPHP%2Femoji_image.php&tab=mobile\",\"_blank\",\"top=50,left=50,height=900,width=1300\");"; $hblurb="Copy (Image) from Google PageSpeed
(thanks, and note to toggle between mobile and desktop tabs perhaps)
and Paste via macOS Alt-PrtScr Below (for Data URI as well)
or to an Image Editor that can Crop out Extraneous White Parts
or Resize Image and Save
(ready for Border Image or Background Image or just Image purposes)"; if (isset($_GET['audio'])) { $hblurb="Copy Audio
via Finder or Windows Explorer
and come Back Here to Paste that Data"; $ei="Audio"; $cr="Paster"; $imgw="audio"; $iaudio="audio"; $iimage="ywnft"; $ivideo="ywnft"; $gps=""; } else if (isset($_GET['video'])) { $hblurb="Copy Video
via Finder or Windows Explorer
and come Back Here to Paste that Data"; $ei="Video"; $cr="Paster"; $imgw="video"; $ivideo="video"; $iaudio="ywnft"; $iimage="ywnft"; $gps=""; } function mycrop($src, array $rect) { // thanks to https://stackoverflow.com/questions/26722811/imagecrop-alternative-for-php-5-5 $dest = imagecreatetruecolor($rect['width'], $rect['height']); imagecopy( $dest, $src, 0, 0, $rect['x'], $rect['y'], $rect['width'], $rect['height'] ); return $dest; } function imageTrimBox($img, $hex=null) { // thanks to https://stackoverflow.com/questions/1669683/crop-whitespace-from-image-in-php if (!ctype_xdigit($hex)) $hex = imagecolorat($img, 0,0); $b_top = $b_lft = 0; $b_rt = $w1 = $w2 = imagesx($img); $b_btm = $h1 = $h2 = imagesy($img); do { //top for(; $b_top < $h1; ++$b_top) { for($x = 0; $x < $w1; ++$x) { if(imagecolorat($img, $x, $b_top) != $hex) { break 2; } } } // stop if all pixels are trimmed if ($b_top == $b_btm) { $b_top = 0; $code = 2; break 1; } // bottom for(; $b_btm >= 0; --$b_btm) { for($x = 0; $x < $w1; ++$x) { if(imagecolorat($img, $x, $b_btm-1) != $hex) { break 2; } } } // left for(; $b_lft < $w1; ++$b_lft) { for($y = $b_top; $y <= $b_btm; ++$y) { if(imagecolorat($img, $b_lft, $y) != $hex) { break 2; } } } // right for(; $b_rt >= 0; --$b_rt) { for($y = $b_top; $y <= $b_btm; ++$y) { if(imagecolorat($img, $b_rt-1, $y) != $hex) { break 2; } } } $w2 = $b_rt - $b_lft; $h2 = $b_btm - $b_top; $code = ($w2 < $w1 || $h2 < $h1) ? 1 : 0; } while (0); // result codes: // 0 = Trim Zero Pixels // 1 = Trim Some Pixels // 2 = Trim All Pixels return array( '#' => $code, // result code 'l' => $b_lft, // left 't' => $b_top, // top 'r' => $b_rt, // right 'b' => $b_btm, // bottom 'w' => $w2, // new width 'h' => $h2, // new height 'w1' => $w1, // original width 'h1' => $h1, // original height ); } $gei=""; $xgei=""; if (isset($_GET['emoji_textarea_image'])) { $gei=str_replace("+"," ",urldecode($_GET['emoji_textarea_image'])); $xgei=$gei; } if (isset($_POST['emoji_uncropped_image']) && isset($_POST['ewidth']) && isset($_POST['eheight'])) { // data:image/png;base64, $datauri=str_replace(" ","+",urldecode($_POST['emoji_uncropped_image'])); if (strpos($datauri, "data:image/") !== false && strpos($datauri, ";base64,") !== false) { $newdu = $datauri; $ext = explode("data:image/", explode(";base64,",$datauri)[0])[1]; $rnum = "" . rand(0,198675433); $im = imagecreatefromstring(base64_decode(explode(";base64,",$datauri)[1])); if (1 == 1) { // find the trimmed image border $box = imageTrimBox($im); // copy cropped portion $im_crop = imagecreate($box['w'], $box['h']); imagecopy($im_crop, $im, 0, 0, $box['l'], $box['t'], $box['w'], $box['h']); } else { $im_crop = mycrop($im, ['x' => 0, 'y' => 0, 'width' => str_replace("+"," ",urldecode($_POST['ewidth'])), 'height' => str_replace("+"," ",urldecode($_POST['eheight']))]); } $delit=""; //$im_crop = imagecropauto($im, IMG_CROP_WHITE); if (strtolower($ext) == "png") { // || substr(strtolower($ext),0,2) == "jp" || strtolower($ext) == "gif") { imagepng($im_crop, "crop_orig" . $rnum . ".png"); $newdu = "data:image/png;base64," . base64_encode(file_get_contents("crop_orig" . $rnum . ".png")); // $delit="rm -f " . dirname(__FILE__) . "/crop_orig" . $rnum . ".png"; // unlink("crop_orig" . $rnum . ".png"); } else if (substr(strtolower($ext),0,2) == "jp") { imagejpeg($im_crop, "crop_orig" . $rnum . ".jpeg"); $newdu = "data:image/jpeg;base64," . base64_encode(file_get_contents("crop_orig" . $rnum . ".jpeg")); // $delit="rm -f " . dirname(__FILE__) . "/crop_orig" . $rnum . ".jpeg"; // unlink("crop_orig" . $rnum . ".jpeg"); } else if (strtolower($ext) == "gif") { imagegif($im_crop, "crop_orig" . $rnum . ".gif"); $newdu = "data:image/" . $ext . ";base64," . base64_encode(file_get_contents("crop_orig" . $rnum . ".gif")); // $delit="rm -f " . dirname(__FILE__) . "/crop_orig" . $rnum . ".gif"; // unlink("crop_orig" . $rnum . ".gif"); //} else if (strtolower($ext) == "bmp") { // imagebmp($im_crop, "crop_orig" . $rnum . ".bmp"); // $newdu = "data:image/" . $ext . ";base64," . base64_encode(file_get_contents("crop_orig" . $rnum . ".bmp")); // unlink("crop_orig" . $rnum . ".bmp"); } imagedestroy($im); imagedestroy($im_crop); echo " 0) { imgs[0].src='" . $newdu . "'; } parent.dorn(); \">"; if ($delit != "") { exec("sleep 30; " . $delit); } } } else if (isset($_GET['emoji_rm_image'])) { if (file_exists('emoji_image.txt')) { $etext=file_get_contents('emoji_image.txt'); if ($etext != trim($etext) && trim($etext) == str_replace("+"," ",urldecode($_GET['emoji_rm_image']))) { unlink('emoji_image.txt'); } } //exec("sleep 50; rm -f " . dirname(__FILE__) . "/emoji_image.txt"); exit; } else if (isset($_GET['emoji_mr_image'])) { exit; } else if (file_exists('emoji_image.txt')) { $etext=file_get_contents('emoji_image.txt'); if ($etext != trim($etext)) { unlink('emoji_image.txt'); } else { file_put_contents('emoji_image.txt', $etext . ' '); } $etext=trim($etext); if (substr(($etext . "z"),0,1) <= "9") { echo "

&#" . str_replace("\n","
",str_replace(".", ";&#", str_replace("+"," ",$etext))) . ";

"; } else { echo "

" . str_replace("\n","
",$etext) . "

"; } } else if (trim($gei) != "" || isset($_GET['emoji_image'])) { if (trim($gei) == "") { $gei=str_replace("+"," ",urldecode($_GET['emoji_image'])); } else if (isset($_GET['emoji_image'])) { $pregei=str_replace("+"," ",urldecode($_GET['emoji_image'])); if (trim($pregei) != "") { $pregei.="\n\n" . $gei; $gei=$pregei; } } if (!isset($_GET['audio']) && !isset($_GET['video'])) { file_put_contents('emoji_image.txt', str_replace(";","",str_replace("&#","",str_replace(";&#",".",$gei))) ); } if (strpos($gei, ".") !== false || strpos($gei, "&#") !== false || strpos($gei, ";") !== false) { $xgei="&#" . str_replace(";","",str_replace("&#","",str_replace(";&#",".",$gei))) . ";"; } else { $xgei=$gei; } $one="1"; $isiPad = (bool) strpos($_SERVER['HTTP_USER_AGENT'],'iPad'); if ($isiPad === false) { $isiPad = (bool) strpos($_SERVER['HTTP_USER_AGENT'],'iPhone'); } if ($isiPad === false) { $isiPad = (bool) strpos($_SERVER['HTTP_USER_AGENT'],'Android'); } if ($isiPad) { $one="3"; $transparent="white"; // $dstyle=" document.getElementById('dstyle').innerHTML+=''; "; } sleep(5); // Thanks to https://stackoverflow.com/questions/28644340/how-do-i-get-base64-encoded-image-from-clipboard-in-internet-explorer/28799619 below ... echo " Emoji Image Creator - RJM Programming - November, 2020 ... thanks to Google PageSpeed

". str_replace("&#;","","&#" . str_replace(".", ";&#", str_replace("+"," ",$etext)) . ";") . "

" . $hblurb . "
" . $ei . " " . $cr . "
(Paste Below)
Data URI
"; //$eresult=file_get_contents("https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fwww.rjmprogramming.com.au%2FPHP%2Femoji_image.php"); //file_put_contents('emojiimage.txt', $eresult); //exec("sleep 15; rm -f " . dirname(__FILE__) . "/emoji_image.txt"); } else { echo " Emoji Image Creator - RJM Programming - November, 2020 ... thanks to Google PageSpeed

Emoji Image Creator

Thanks to Google PageSpeed and Stack Overflow and jQuery





      
"; } ?>