-
-
- $im = imagecreatefromjpeg($_file["upload"]["tmp_name"]); //You want to draw a picture of the water example
- $watermark = imagecreatefrompng("Smiley.png") ; //The path of the watermark image
- $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 image with watermark
- / /You can use type to determine the image type
- //switch($_file["upload"]["type"])
- //case:1
- //Then use different functions
- //imagejpeg() to correspond to jpeg
- / /imagegif() corresponds to gif
- //imagepng() corresponds to png
- imagedestroy($im);
Copy code
|