uzuzoo/watermark

Watermark Different File Types

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

This package is not auto-updated.

Last update: 2025-02-01 21:52:03 UTC


README

This package was created to allow watermarking of various file types.

Features

  • 9 watermark positions
  • 2 types of watermark [text & image]
  • watermark padding
  • image watermark resize
  • image watermark opacity
  • TrueType Font text watermark size
  • TrueType Font text watermark colour
  • TrueType Font text watermark angle: 360 degree rotation

Supported File types

Supported Watermark Images

Supported Watermark Text

As an alternative to a Watermark image, support is also available for TrueType Font watermarking with 360 degrees of rotation on the text. There are also methods to install and uninstall TrueType Fonts.

NOTE: When the InputFile is a PDF and WmType is Text, the 'WmText' Text will be converted to an Image before being placed on the PDF!

Basic Usage

<?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();

}

Options

Options can be passed, as an array, into the constructor of Watermark or on the apply method. Alternatively, each option has a getter and setter, and can used by prefixing the option name with set or get respectively.

E.G. to set the InputFile use $wm->setInputFile($path_to_file) and to get $wm->getInputFile()