-
-
$im = imagecreatefromjpeg($_file["upload"]["tmp_name"]); //Picture
- $watermark = imagecreatefrompng("Smiley.png"); //Watermark image Path
- $im_x = imagesx($im);
- $im_y = imagesy($im);
- $w_x = imagesx($watermark);
- $w_y = imagesy($watermark);
- imagecopy($im,$watermark, $im_x-$w_x,$im_y-$w_y,0,0,$w_x,$w_y);
- imagejpeg($im); //You can add a path to save the watermarked image
- < p>//Use type to determine the image type
- //switch($_file["upload"]["type"])
- //case:1
- //Other gd library functions
- //imagejpeg() corresponds to jpeg
- //imagegif() corresponds to gif
- //imagepng() corresponds to png
- imagedestroy($im);
-
Copy code
|