Simple php image uploads automatically add watermarks to images

Source: Internet
Author: User
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 ^

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.