ckfinder/ckfinder-plugin-imagewatermark-php

CKFinder 3 图像水印插件

3.4.0 2016-04-01 12:44 UTC

This package is not auto-updated.

Last update: 2024-09-18 07:19:00 UTC


README

这是一个官方CKFinder 3插件,可以为通过CKFinder上传的图像添加水印。

支持的图像扩展名: jpg, jpeg, gif, png.

插件安装

请参阅插件安装和配置文档。

配置选项

要将自定义图像设置为水印,请将以下选项添加到主CKFinder配置文件中(通常命名为 config.php

// ...
$config['ImageWatermark'] = [
    'imagePath' => __DIR__ . '/custom/image/path/stamp.png'
];

注意:请确保您的图像路径是绝对路径,并使用透明的 png 图像以获得最佳效果。

要更改默认水印位置,您需要在插件配置节点中添加 position 选项

// ...
$config['ImageWatermark'] = [
    'imagePath' => __DIR__ . '/custom/image/path/stamp.png', // Also use a custom image.
    'position' => [
        'right'  => 0,
        'bottom' => 0
    ]
];

position 选项包含与图像边框对应的两个参数。

可能的 position 键值有: toprightbottomleft

top-bottomleft-right 子选项互斥,不能同时使用。

每个位置子选项可以接受一个整数作为值。这个整数表示以像素为单位的所选边界的距离。或者,您可以使用 'center' 字符串将水印居中于当前边界和相对边界之间。

以下是几个水印(▣)位置示例,以下 position 选项使用:

$config['ImageWatermark'] = [               ┌────────────────┐
    'position' => [                         │                │
        'right'  => 0,                      │                │
        'bottom' => 0                       │              ▣ │
    ]                                       └────────────────┘
];
$config['ImageWatermark'] = [               ┌────────────────┐
    'position' => [                         │                │
        'right'  => 'center',               │                │
        'bottom' => 0                       │        ▣       │
    ]                                       └────────────────┘
];
$config['ImageWatermark'] = [               ┌────────────────┐
    'position' => [                         │                │
        'right'  => 0,                      │               ▣│
        'bottom' => 'center'                │                │
    ]                                       └────────────────┘
];

许可

版权(c)2007-2016,CKSource - Frederico Knabben。保留所有权利。有关许可详情请参阅:LICENSE.md