uzuzoo/watermark

水印不同文件类型

dev-master 2016-10-18 15:26 UTC

This package is not auto-updated.

Last update: 2024-09-28 20:03:35 UTC


README

此包的创建是为了允许对各种文件类型进行水印。

功能

  • 9种水印位置
  • 2种水印类型[文本 & 图片]
  • 水印填充
  • 图片水印调整大小
  • 图片水印不透明度
  • TrueType 字体文本水印大小
  • TrueType 字体文本水印颜色
  • TrueType 字体文本水印角度:360度旋转

支持的文件类型

支持的水印图片

支持的水印文本

作为水印图片的替代方案,也支持TrueType字体水印,文本可进行360度旋转。同时也有安装和卸载TrueType字体的方法。

注意:当输入文件是PDF且WmType是文本时,'WmText'文本将在放置到PDF之前被转换为图片!

基本用法

<?php
use Uzuzoo\Watermark\Watermark;

$params = array(
  'InputFile' => 'images/image.jpg',
);

// Start the Watermarking process
try {

  // Instantiate the Watermark Class
  $wm = new Watermark($params);

  // Apply the Watermarking
  $result = $wm->apply();

  // Return the watermarked File path & filename
  $output = $wm->getOutput();

} catch (Exception $e) {

  // Any validation errors will cause an Exception to be thrown
  echo $e->getMessage();

}

选项

选项可以作为数组传递给Watermark的构造函数或apply方法。或者,每个选项都有一个getter和setter,可以通过分别使用set或get前缀来使用。

例如,要设置InputFile,请使用$wm->setInputFile($path_to_file),要获取$wm->getInputFile()