strlen($bottomlinewording)) $wis='' . strlen($toplinewording) * 12; } else if (isset($_POST['toplinewording'])) { $toplinewording=urldecode($_POST['toplinewording']); if (strlen($toplinewording) > strlen($bottomlinewording)) $wis='' . strlen($toplinewording) * 12; } if (isset($_GET['bottomlinewording'])) { $bottomlinewording=urldecode($_GET['bottomlinewording']); if (strlen($bottomlinewording) > strlen($toplinewording)) $wis='' . strlen($bottomlinewording) * 12; } else if (isset($_POST['bottomlinewording'])) { $bottomlinewording=urldecode($_POST['bottomlinewording']); if (strlen($bottomlinewording) > strlen($toplinewording)) $wis='' . strlen($bottomlinewording) * 12; } $imis='photo.jpeg'; if (isset($_GET['image'])) { $imis=urldecode($_GET['image']); $iimis=strtolower(explode("/",$imis)[-1 + sizeof(explode("/",$imis))]); if (strpos($iimis, ".jp") !== false) { $im = imagecreatefromjpeg($imis); } else if (strpos($iimis, ".png") !== false) { $im = imagecreatefrompng($imis); } else if (strpos($iimis, ".gif") !== false) { $im = imagecreatefromgif($imis); } else { $im = imagecreatefromstring(file_get_contents($imis)); } } else if (isset($_POST['image'])) { $imis=urldecode($_POST['image']); $iimis=strtolower(explode("/",$imis)[-1 + sizeof(explode("/",$imis))]); if (strpos($iimis, ".jp") !== false) { $im = imagecreatefromjpeg($imis); } else if (strpos($iimis, ".png") !== false) { $im = imagecreatefrompng($imis); } else if (strpos($iimis, ".gif") !== false) { $im = imagecreatefromgif($imis); } else { $im = imagecreatefromstring(file_get_contents($imis)); } } else if (12 == 12) { echo " Watermarking Existant Image - RJM Programming - April, 2018 ... thanks to https://php.net/manual/en/image.examples.merged-watermark.php

Watermarking Existant Image

RJM Programming

April, 2018

Thanks to https://php.net/manual/en/image.examples.merged-watermark.php

Image filename or URL:
Watermark opacity 0 to 100:
Watermark Wording Top line:
Watermark Wording Bottom line:


"; exit; } else { $im = imagecreatefromjpeg($imis); } $imis=explode("/",$imis)[-1 + sizeof(explode("/",$imis))]; $imwillbe='watermarked_' . str_replace("." . explode(".",$imis)[-1 + sizeof(explode(".", $imis))], ".png", $imis); // First we create our stamp image manually from GD $stamp = imagecreatetruecolor($wis, 70); imagefilledrectangle($stamp, 0, 0, (-1 + $wis), 69, 0x0000FF); imagefilledrectangle($stamp, 9, 9, (-10 + $wis), 60, 0xFFFFFF); imagestring($stamp, 5, 20, 20, $toplinewording, 0x0000FF); imagestring($stamp, 3, 20, 40, $bottomlinewording, 0x0000FF); // Set the margins for the stamp and get the height/width of the stamp image $marge_right = 10; $marge_bottom = 10; $sx = imagesx($stamp); $sy = imagesy($stamp); // Merge the stamp onto our photo with an opacity of 50% imagecopymerge($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp), $opacity); // Save the image to file and free memory while (file_exists($imwillbe)) { $imwillbe='watermarked_' . str_replace("." . explode(".",$imwillbe)[-1 + sizeof(explode(".",$imwillbe))], ".png", $imwillbe); } imagepng($im, $imwillbe); //'photo_stamp.png'); imagedestroy($im); header('Content-Type: image/png'); echo file_get_contents($imwillbe); unlink($imwillbe); exit; ?>