承接 treinetic/imageartist 相关项目开发

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

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

treinetic/imageartist

Composer 安装命令:

composer require treinetic/imageartist

包简介

ImageArtist is a php gd Wrapper which makes Image manipulation insanely easy, we introduce ImageArtist as Photoshop for php

README 文档

README

ImageArtist Banner

Try out before you actually use it docker run --pull always -p 9090:80 treineticprojects/demo_opensource:latest

ImageArtist 2.0.0

ImageArtist is a modern PHP library for easy image manipulation using the GD extension. Think of it as a fluent, cleaner API for GD. It simplifies complex tasks like shapes, text overlays, and merging.

This project is an initiative of Treinetic (Pvt) Ltd, Sri Lanka.

Issues Software License Forks Stars Twitter

Features

Feature Description
Fluent API Chained methods for intuitive image manipulation (scale()->crop()->save()).
Shapes Built-in support for Triangles, Polygons, Circles, and Squares.
Text Overlays Add multi-line text with custom fonts, colors, and positioning.
Layer System New: Non-destructive editing with stacks, opacity control, and visibility toggles.
Filters & Effects New: Apply standard filters (Grayscale, Blur, Brightness) fluently.
Smart Merging Merge multiple images, shapes, or overlays with alpha blending support.
Geometric Helpers Easy coordinate and size calculations.
Zero Dependencies Lightweight, relying primarily on the standard GD extension.

Requirements

  • PHP 8.2 or higher
  • ext-gd extension

Optional:

  • ext-imagick (Required for advanced features in future versions)

Installation

1. System Dependencies

This library requires the GD Extension enabled in your environment.

Docker (Dockerfile)

RUN docker-php-ext-install gd

Ubuntu / Debian

sudo apt-get install php-gd

Alpine Linux

apk add php-gd

2. Composer

Install the package via composer:

composer require treinetic/imageartist

Usage

Basic Usage

First, import the necessary classes. Note: The namespace has been streamlined to Treinetic\ImageArtist.

use Treinetic\ImageArtist\Image;

// Load an image
$image = new Image("./morning.jpeg");

// Scale to 40%
$image->scale(40);

// Resize to specific dimensions
$image->resize(1024, 768);

// Save or Output
$image->save("./newImage.jpg", IMAGETYPE_PNG);

Shape & Attributes

Tip

New: Detailed documentation and examples for all shapes are available in only docs/shapes.md.

use Treinetic\ImageArtist\Image;
use Treinetic\ImageArtist\Shapes\Triangle;
use Treinetic\ImageArtist\Commons\Node;

// Create a Triangle from an image
$triangle = new Triangle("./city.jpg");
// ... rest of the example
$triangle->scale(60);
// Set points (Percentage or Pixels)
$triangle->setPointA(20, 20, true);
$triangle->setPointB(80, 20, true);
$triangle->setPointC(50, 80, true);
$triangle->build();

$triangle->save("./triangle.png", IMAGETYPE_PNG);

Advanced Merging & Overlays

Tip

New: Detailed documentation for Text and Overlays is available in docs/text.md.

use Treinetic\ImageArtist\Image;
use Treinetic\ImageArtist\Overlays\Overlay;
use Treinetic\ImageArtist\Shapes\CircularShape;
use Treinetic\ImageArtist\Text\TextBox;
use Treinetic\ImageArtist\Text\Color;
use Treinetic\ImageArtist\Text\Font;

$img = new Image("./background.jpg");
// ... rest of the example
// Add an overlay
$overlay = new Overlay($img->getWidth(), $img->getHeight(), new Color(0, 0, 0, 80));
$img->merge($overlay, 0, 0);

// Add a circular profile picture
$circle = new CircularShape("./person.jpg");
$circle->build();
$img->merge($circle, ($img->getWidth() - $circle->getWidth()) / 2, ($img->getHeight() - $circle->getHeight()) / 2);

// Add Text
$textBox = new TextBox(310, 40);
$textBox->setColor(new Color(255, 255, 255)); // White
$textBox->setFont(Font::getFont(Font::$NOTOSERIF_REGULAR));
$textBox->setSize(20);
$textBox->setText("We Are Team Treinetic");

$img->setTextBox($textBox, ($img->getWidth() - $textBox->getWidth()) / 2, $img->getHeight() * (5/7));

// Output directly to browser (ImageArtist 1.0 style)
$img->dump(); 

// For modern usage, see new features:
// - [Layers System](docs/layers.md)
// - [Filters & Effects](docs/filters.md)

Contributing

Please see CONTRIBUTING for details.

Credits

License

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

treinetic/imageartist 适用场景与选型建议

treinetic/imageartist 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 80.45k 次下载、GitHub Stars 达 87, 最近一次更新时间为 2017 年 09 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「scale image」 「image merge」 「GD Made Easy」 「PHP GD Wrapper」 「Easy GD Wrapper」 「Image Shape crop」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 treinetic/imageartist 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 treinetic/imageartist 我们能提供哪些服务?
定制开发 / 二次开发

基于 treinetic/imageartist 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 80.45k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 90
  • 点击次数: 29
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 87
  • Watchers: 5
  • Forks: 23
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-09-10