Share a PHP class that adds watermarks to images. It supports watermark images. The calling method is send( strimg filename ). This method has a function that can be omitted. In the case of omission, the path and name of the saved image will be the same as the original one. , if you need to save it as an exception picture, just provide the path and name of the picture to be saved here
Exception, there is another method, show(); This method is used to display the watermarked picture
This method can Call it alone, but you must call the send() method first, or you can call it continuously: $img->send()->show();
Step 1: Download what we need for this lesson PHP class for adding watermarks to images: //m.sbmmt.com/xiazai/leiku/761
Step 2: After the download is complete, find the PHP class file and unzip it to the local server. Create a new php file!
Step 3: We call this class in this new file and instantiate this class:
imgpath($oldimg, $newing, $WeiZhi = 9);//$WeiZhi 水印位置 print_r($img->send());//开始加水印 ?>
Here we print out the location information of the picture:
Then find the original picture:
The above is the detailed content of The implementation process of adding watermark to pictures in php. For more information, please follow other related articles on the PHP Chinese website!