Adding watermarks to images on your website and leaving your own information on the images has two advantages: first, promoting your own brand, second, even if an article with images is reprinted, the copyright will automatically be left. This article mainly implements php image upload to automatically add watermarks to images. in the next article... adding watermarks to images on your website and leaving your own information on the images has two advantages: first, promoting your own brand, second, even if an article with images is reprinted, the copyright will automatically be left.
This article mainly implements php image upload to automatically add watermarks to images. in the next article, I will provide code for adding text watermarks with php.
It is actually very easy for php to add watermarks to images. it is not as amazing as it is imagined. it is to use a GD Library in php. Speaking of the GD library, it is actually an extension in php specifically used to process images, such as the verification code we are familiar with and thumbnails are generated, including what we call php today, adding watermarks to images requires the support of the GD Library.
Tip: You may need to enable the GD Library for the newly installed php environment. open php. ini, remove ";" Before extension = php_gd2.dll, and then restart apache/iis.
The implementation is not complex, and there are less than 20 lines of core code, mainly just a few functions.
Source code:
Adding watermarks to images is not only implemented using the basic GD library, but also the ImageMagick tool. it has more powerful functions. However, the above code is generally used when there is little need.
Permanent address:
Reprint at will ~ Please bring the tutorial URL ^