PHPackages                             alexsanqp/watermark - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. alexsanqp/watermark

AbandonedArchivedLibrary[Image &amp; Media](/categories/media)

alexsanqp/watermark
===================

Creating a watermark by position in the image

144PHP

Since Jul 5Pushed 7y ago1 watchersCompare

[ Source](https://github.com/alexsanqp/watermark)[ Packagist](https://packagist.org/packages/alexsanqp/watermark)[ RSS](/packages/alexsanqp-watermark/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Yii2 library Watermark
======================

[](#yii2-library-watermark)

Creating a watermark by position in the image

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist alexsanqp/watermark "*"

```

or add

```
"alexsanqp/watermark": "*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

Once the extension is installed, simply use it in your code by :

```
public function actionWatermark()
{
    $pathToWatermark = '@app/web/img/plusminus-watermark.png';
    $pathToImage = '@app/web/img/mountain.jpg';

    //If you need to set the image proportions
    $width = Yii::$app->request->get('width');
    $height = Yii::$app->request->get('height');

    $watermark = new Watermark($pathToImage, $pathToWatermark);
    $watermark->setPercentageRatio(0.4);
    $watermark->setPosition(Position::CENTER, Position::CENTER);
    $watermark->rotate(-40);

    if (!empty($width) && !empty($height)) {
        $watermark->setProportionImage($width, $height);
    }

    // append watermark
    $watermark->watermark();

    // Save
    if ($watermark->save()) {
        echo $watermark->getSaveImagePath();
    }

    // Or

    $rawImageWatermark = $watermark->getImageWithWatermark();

    if ($rawImageWatermark) {
        $imageWatermark = imagecreatefromstring($rawImageWatermark->get('jpg'));

        if ($imageWatermark !== false) {
            header('Content-Type: image/jpeg');

            imagejpeg($imageWatermark, null, 90);
            imagedestroy($imageWatermark);
        }
    }
}
```

[![](https://user-images.githubusercontent.com/16621122/42344046-c092cb78-80a3-11e8-877e-15d485ec2416.jpg)](https://user-images.githubusercontent.com/16621122/42344046-c092cb78-80a3-11e8-877e-15d485ec2416.jpg)

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16621122?v=4)[Oleksandr K.](/maintainers/alexsanqp)[@alexsanqp](https://github.com/alexsanqp)

---

Top Contributors

[![alexsanqpray](https://avatars.githubusercontent.com/u/27004229?v=4)](https://github.com/alexsanqpray "alexsanqpray (1 commits)")

### Embed Badge

![Health badge](/badges/alexsanqp-watermark/health.svg)

```
[![Health](https://phpackages.com/badges/alexsanqp-watermark/health.svg)](https://phpackages.com/packages/alexsanqp-watermark)
```

###  Alternatives

[goat1000/svggraph

Generates SVG graphs

133890.0k3](/packages/goat1000-svggraph)[imagekit/imagekit

PHP library for Imagekit

46877.3k10](/packages/imagekit-imagekit)[gravatarphp/gravatar

Gravatar URL builder which is most commonly called as a Gravatar library

12644.1k2](/packages/gravatarphp-gravatar)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
