Using PHP code to add watermarks to images _php tutorial

Source: Internet
Author: User

Use PHP code to add watermarks to images


This article mainly introduces the use of PHP code to image watermark information, the need for friends can refer to the following

First look for a picture, renamed to Face.jpeg, create watermark.php:

?

1

2

3

4

5

6

7

8

9

10

11

12

/**

* Created by Phpstorm.

* User:administrator

* DATE:2015/6/29

* time:22:27

*/

$img = Imagecreatefromjpeg (' face.jpeg ');//create image based on existing JPG

Header (' content-type:image/jpeg ');//Set MIME type

Imagestring ($img, 5,5,5, ' vito-l ', Imagecolorallocate ($img, 255,0,0));//Generate watermark, imagestring (picture, font, position x, position y, string, color)

Imagejpeg ($img);//Output picture

The upper-left corner of the entire image is 0,0

The effect is as follows:

The above mentioned is the whole content of this article, I hope you can like.

http://www.bkjia.com/PHPjc/1025318.html www.bkjia.com true http://www.bkjia.com/PHPjc/1025318.html techarticle use PHP code to add a watermark to the picture This article mainly introduces the use of PHP code to image watermark related information, the need for friends can refer to the first to find a picture, renamed to Face.jpeg, Chong ...

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