PHP code example of juchengit / watermark

1. Go to this page and download the library: Download juchengit/watermark library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

juchengit / watermark example snippets




$pic_path="http://p0.meituan.net/128.180/movie/4c01895cfd53e82f7c3048c407974a6b4739229.jpg";//支持绝对路径和网址
$water=new \watermark\WaterMark();
$water->text_color=[220,220,220];//虹路蓝三色比例
$water->fontfile='./static/common/font/msyh.ttf';
$water->inter_w=50;//水印文字间隔宽
$water->inter_h=50;//水印文字间隔宽
$water->maker_text="合智聚成";//水印文字
$water->text_size=10;//水印文字大小
$water->text_angle=50;//水印倾斜角度  0是平行  90是垂直
$water->save_path="./upload";//默认保存路径
$water->addWaterMark();