itself is not to upload images to add watermark function, want to upload the time to add a picture watermark, but also very simple. Take Ueditor 1.2.6 as an example, open the imageup.php file under the PHP directory and look for "$info = $up->getfileinfo ();", add the following code below this code:
Then save it, and it's OK. Note, however, that $water _img = "watermark.png";//Watermark file (replace here with the watermark you want).
/* Add watermark Start/*
$water _img = "Watermark.png"; Watermark file (replace here with the watermark you want)
$img _min_w = 350; Adding a watermark requires the minimum width (px) of the picture, and does not add a watermark when it is less than this width
$img _min_h = 60; Adding a watermark requires a minimum image height (px)
$new _img = $ori _img = $info ["url"];
$original = getimagesize ($ori _img); To get a picture of the information, you can Print_r ($original) that it is an array
if ($original [0]> $img _min_w&& $original [1]> $img _min_h) {//watermark is added when the picture is wider than 300px
$watermark = getimagesize ($water _img);
$s _original = imgcreatefrom ($ori _img, $original [2]); $original [2] is a picture type, where 1 represents GIF, 2 for JPG, 3 for PNG
$s _watermark = imgcreatefrom ($water _img, $watermark [2]);
$posX = $original [0]-$watermark [0]-6; x coordinate (lower right corner)
$poxY = $original [1]-$watermark [1]-3; Y-coordinate (lower right corner)
Hit watermark
Imagecopy ($s _original, $s _watermark, $posX, $poxY, 0, 0, $watermark [0], $watermark [1]);
Imagejpeg ($s _original, $new _img); Generate a new picture
}
Create a new image from a file type
function Imgcreatefrom ($img _src, $val) {
Switch ($val) {
Case 1: $img = imagecreatefromgif ($img _src);
Break
Case 2: $img = Imagecreatefromjpeg ($img _src);
Break
Case 3: $img = imagecreatefrompng ($img _src);
Break
}
return $img;
}
/* Add watermark End/*