Pimchanok leuwisetpaiboon Analysis of PHP watermark Technology

Source: Internet
Author: User
PHP object processing has been not very familiar with, used to be used in the time to find the manual. Today, someone in the Phpchina forum asked about the watermark of the relevant issues, just I want to learn, so the next PHP implementation of the image watermark implementation.
Find the manual, found that the PHP GD library is really powerful and easy to implement the watermark function. The watermark is actually merging two images. The same can be achieved for watermark text.
I provide simple learning examples, very simple, mainly to understand the principle.
Two pictures: 1, photo.jpg watermark picture

2. Source.gif Watermark Image

The following code mainly implements the watermark function.

Header ("Content-type:image/jpeg");
$filename = '. /src/images/photo.jpg ';
$im =imagecreatefromjpeg ($filename);
$s =imagecreatefromgif ('.. /src/images/source.gif ');
Imagecopymerge ($im, $s, 0,0,0,0,132,27,60);
Imagejpeg ($im);


The watermark results are as follows:

Hehe, the detailed function you can realize by yourself.

The above describes the Pimchanok Leuwisetpaiboon analysis of PHP watermark technology, including the Pimchanok Leuwisetpaiboon aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.