承接 netwerkstatt/silverstripe-image-toolkit 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

netwerkstatt/silverstripe-image-toolkit

最新稳定版本:1.0

Composer 安装命令:

composer require netwerkstatt/silverstripe-image-toolkit

包简介

A Silverstripe module with various image manipulations (Watermark, AutoOrient, ColorOverlay, etc.) via Intervention Image.

README 文档

README

This module provides a collection of image manipulations for Silverstripe CMS using Intervention Image V3. It's specifically designed for Silverstripe 6 and leverages the power of the Intervention Image library for various effects and optimizations.

Installation

composer require netwerkstatt/silverstripe-image-toolkit

Features

  • Watermark: Add a logo or image as a watermark. Supports flexible positioning, padding, opacity, and relative sizing. Now also stable against circular references when using Image objects or their IDs.
  • Auto-Orient: Automatically corrects image orientation based on EXIF data (ideal for mobile uploads).
  • Color Overlay: Places a semi-transparent color over an image (useful for banners and hero sections).

Configuration

The toolkit is automatically registered for SilverStripe\Assets\Image and SilverStripe\Assets\Storage\DBFile. You can customize default settings via YAML.

Watermark Configuration

Netwerkstatt\ImageToolkit\Extension\Watermark:
  default_watermark_logo: 'themes/your-theme:images/watermark.png'
  default_watermark_opacity: 0.5
  default_watermark_position: 'bottom-right'
  default_watermark_padding: '5%'
  default_watermark_width: '25%'

Usage

In your templates or PHP code, you can use the toolkit methods on any Image or DBFile object.

Watermark

Adds a watermark to the image. You can pass an Image object, an ID, or a path.

$Image.Watermark
$Image.Watermark($CustomLogo.ID, 'center', '10%', 0.5, '50%')
$Image.Watermark($CustomLogo.ID, 'bottom-right')

Note: Using the ID ($Logo.ID) is particularly stable as the object is only loaded when needed. However, this also prevents circular reference errors when passing whole objects.

Auto-Orient (Alias: AutoOriented)

Corrects the orientation of an image based on its EXIF data.

$Image.AutoOrient

Color Overlay (Alias: ColorOverlayed)

Applies a color overlay. Perfect for making text more readable on images.

$Image.ColorOverlay('#000000', 0.4)

Chaining

All methods are "fluent" and can be combined:

$Image.AutoOrient.ScaleWidth(1200).ColorOverlay('#333', 0.5).Watermark

Advanced: Watermark Logo Hook

You can dynamically change the watermark logo (e.g., from SiteConfig) using the updateWatermarkLogo hook:

use SilverStripe\Core\Extension;

class MyImageExtension extends Extension
{
    public function updateWatermarkLogo(&$logo)
    {
        $siteConfig = \SilverStripe\SiteConfig\SiteConfig::current_site_config();
        if ($siteConfig->WatermarkLogoID) {
            $logo = $siteConfig->WatermarkLogo();
        }
    }
}

Requirements

  • PHP ^8.2
  • Silverstripe Framework ^6
  • Silverstripe Assets ^3

License

See LICENSE

统计信息

  • 总下载量: 12
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2026-03-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固