PHPackages                             smallnews/poster - 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. smallnews/poster

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

smallnews/poster
================

A make poster package

0.03(6y ago)211MITPHP

Since Sep 2Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Wsmallnews/poster)[ Packagist](https://packagist.org/packages/smallnews/poster)[ RSS](/packages/smallnews-poster/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (5)Used By (0)

 poster
========

[](#-poster-)

 A make poster package.

Requirements
------------

[](#requirements)

- PHP &gt;= 5.4
- intervention/image &gt;= 2.0
- Fileinfo PHP Extension

Installing
----------

[](#installing)

```
$ composer require smallnews/poster -vvv

```

Usage
-----

[](#usage)

```
require __DIR__ .'/vendor/autoload.php';

use Smallnews\Poster\MakePoster;

$makePoster = new MakePoster();

$makePoster->init([
    'path' => './posterBG.png'),
    'width' => 750,
    'height' => 1334
])->addTexts([[
    'string' => '这里是很长很长很长的商家名称',
    'is_hidden' => true,        // 超出打印宽度是否 显示省略号
    'x' => 250,                 // 打印位置 x 坐标
    'y' => 206,                 // 打印位置 y 坐标
    'line' => [                 // 文字划线，删除线|下划线|上划线
        'type' => 'through',    // through |overline | underline
        'color' => '#FF0000',
    ],
    'line' => 'through',        // 文字划线，简写版 颜色默认为字体颜色
    'color' => '#ffffff',       // 字体颜色
    'size' => 28,               // 字体大小
    'font_file' => './pingfang.ttf',    // 自定义字体文件，默认字体文件 pingfang.ttf
    'align' => 'left',          // 对齐方式，同 intervention/image align
    'valign' => 'top',          // 垂直对齐方式，同 intervention/image valign
    'line_height' => 38,        // 每一行的高度，也就是下一行开始打印的位置为 y + line_height
    'width' => 375,             // 文本打印宽度
    'lines' => 1,               // 打印行数
    'start_len' => 8,           // 最大中文字符数，width 能容下的最多的文字个数减去 1-5
],[
    ...
]])->addImages([[
    // 产品图
    'path' => (new ImageManager())->make('./poster-logo.png'),
    'width' => 634,
    'height' => 380,
    'x' => 58,
    'y' => 276,
],[
    // 头像
    'path' => './poster-logo.png',
    'width' => 80,
    'height' => 80,
    'x' => 66,
    'y' => 1062,
]])->addTagGroups([[                                       // 所有配置参数
    'tags' => ['第一个标签', '90 后', ...],  // 标签数组
    'tags' => '第一个标签',                  // 单个标签
    'x' => 58,                              // 开始打印 x 坐标
    'y' => 276,                             // 开始打印 y 坐标
    'width' => 450,                         // 最大打印宽度，超出隐藏或换行
    'color' => '#FFBE41',                   // 字体颜色
    'size' => 28,                           // 文字大小
    'lines' => 2,                           // 打印行数，超出剩余的标签将不显示
    'spacing' => 30,                        // 两个标签之间的距离
    'padding' => [10, 24, 10, 24],          // 文字距离背景的 padding  【上，右，下，左】
    'bg_color' => '#FFF6DC',                // 背景颜色
    'border' => 1,                          // 背景边框，默认 0 没有边框
    'bd_color' => "#FFBE41",                // 边框颜色
    'height_spacing' => 20,                 // 两行之间的距离
    'font_file' => './pingfang.ttf',        // 字体文件，默认 苹方常规字体
],[                                       // 简单打印一个标签
    'tags' => '第一个标签',                  // 单个标签
    'x' => 58,                              // 开始打印 x 坐标
    'y' => 476,                             // 开始打印 y 坐标
]])
->draw()->save('./abc.jpg');

```

Api
---

[](#api)

初始化图像实例

```
$makePoster->init([]);

```

添加水印文字

```
$makePoster->addText([字体属性]);

```

添加多个水印文字

```
$makePoster->addTexts([
    [字体属性],
    [字体属性],
]);

```

添加水印图片

```
$makePoster->addImage([图片属性]);

```

添加多个水印图片

```
$makePoster->addImages([
    [图片属性],
    [图片属性],
]);

```

添加标签组

```
$makePoster->addTagGroup([标签属性]);

```

添加多个标签组

```
$makePoster->addTagGroups([
    [标签属性],
    [标签属性],
]);

```

将添加的水印 绘制到图像实例

```
$makePoster->draw();

```

将未绘制的水印，添加到图像实例，并保存图像实例

```
$makePoster->save();

```

本扩展包仅仅对 intervention/image 的部分进行了功能行封装， 可通过 image 属性直接调用 intervention/image 方法

```
$makePoster->image->text('文本', 0, 0, function($font) {
    $font->size(24);
    $font->color('#fdf6e3');
};

```

License
-------

[](#license)

The MIT License (MIT). Please see License File for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

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.

###  Release Activity

Cadence

Every ~8 days

Total

4

Last Release

2417d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5ec01fd8be2364f1dbffd4ded72ade8c90d6ac248a8279e0f56d206e41118734?d=identicon)[Wsmallnews](/maintainers/Wsmallnews)

---

Tags

laravelimagegdimagickwatermarkposter

### Embed Badge

![Health badge](/badges/smallnews-poster/health.svg)

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

###  Alternatives

[intervention/image-laravel

Laravel Integration of Intervention Image

1496.5M100](/packages/intervention-image-laravel)[folklore/image

Image manipulation library for Laravel 5 based on Imagine and inspired by Croppa for easy url based manipulation

270248.2k5](/packages/folklore-image)[intervention/image-symfony

Symfony Integration of Intervention Image

1066.8k](/packages/intervention-image-symfony)

PHPackages © 2026

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