= 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']))]); } //$im_crop = imagecropauto($im, IMG_CROP_WHITE); if (strtolower($ext) == "png") { imagepng($im_crop, "crop_orig" . $rnum . ".png"); $newdu = "data:image/" . $ext . ";base64," . base64_encode(file_get_contents("crop_orig" . $rnum . ".png")); unlink("crop_orig" . $rnum . ".png"); } imagedestroy($im); imagedestroy($im_crop); echo "
0) { imgs[0].src=='" . $newdu . "'; } \">"; } } 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))) . ";
" . str_replace("\n","
",$etext) . "
". str_replace("","","" . str_replace(".", ";", str_replace("+"," ",$etext)) . ";") . "
Emoji Image Creator (Paste Below) | Data URI |
---|---|
Copied image src (that you can Email 📧): |
" . $xgei . "
"; //$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 "