Download the PHP package ajaxray/php-watermark without Composer

On this page you can find all versions of the php package ajaxray/php-watermark. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-watermark

PHPWatermark

SensioLabsInsight Latest Stable Version Build Status Coverage Status Total Downloads License

Add text or image Watermark on image and PDF using PHP and ImageMagick.

Pre-requisite

PHP ImageMagick extension is not required.

Installation

Add as a dependency with composer

Or download latest version as a Zip file.

For PHP versions >= 5.6 to <8 use v0.1.2

Also you should check older readme file for PHP version <8

How to use?

If output file name is skipped for Watermark::write() function, the source file will be overridden.

Customization options

The table below shows customization options and their support matrix. Listed functions should be called on an object of Ajaxray\PHPWatermark\Watermark. Checkmark column titles means the following -

⌛ = coming soon!

Function Value Txt-Img Img-Img Txt-PDF Img-PDF
setFont('Arial') string; Font Name
setFontSize(36) int; Font size
setOpacity(.4) float; between 0 (opaque) to 1 (transparent)
setRotate(245) int; between 0 to 360
setPosition($position) int; One of Watermark::POSITION_* constants
setOffset(50, 100) int, int; X and Y offset relative to position
setStyle($style) int; One of Watermark::STYLE_* constants
setTiled() boolean; (default true)
setTileSize(200, 150) int, int; Width and Height of each tile

BTW, all the samples linked above are the results of these examples. You may generate them yourself just by running example scripts from command line -

Then you should get the result files in vendor/ajaxray/php-watermark/examples/img and vendor/ajaxray/php-watermark/examples/pdf directories.

Something unexpected? Debug! 🐞🔫

If anything unexpected happened, try to debug the issue.

  1. First step is to check if PHP is configured to display errors. Alternatively you may add these lines at the top of your script.

  2. A common reason of not getting expected result is mistakes in filepaths. You may try logging / printing source and destination file paths.
  3. Check the permission of the parent directory of destination path. Destination directory indicates -
    • The file path mentioned in the second argument of Watermark::withText() and Watermark::withImage() methods.
    • Parent of the source file itself if no separate destination mentioned in above methods.
  4. There is Watermark::setDebug() method which will make Watermark object to return imagemagick command instead of executing it. Then, you may run the output manually to check if there is any error in underlying imagemagick commands.

Notes:

Important Update for PDF watermarking:

When using the imagemagick + ghostscript extraction and joining pdf pages, it has a few drawbacks including file-size issue. Many developers were asking for a solution about the file size and PDF quality since releasing of this library. So, I've created a command line tool for PDF watermarking that will work without converting pages into images. As a result, you'll get better PDF quality and dramatically smaller file size.

https://github.com/ajaxray/markpdf

Please note that, it's not a PHP library. So you've to use it using exec, shell_exec or Symfony Process Component.


"This is the Book about which there is no doubt, a guidance for those conscious of Allah" - Al-Quran


All versions of php-watermark with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6 <8
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ajaxray/php-watermark contains the following files

Loading the files please wait ....