承接 pixelandtonic/imagine 相关项目开发

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

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

pixelandtonic/imagine

Composer 安装命令:

composer require pixelandtonic/imagine

包简介

Image processing for PHP

README 文档

README

PHPUnit Coding Style

Note: This is an official fork of Bulat Shakirzyanov’s “Imagine” image manipulation library for PHP.

Tweet about it using the #php_imagine hashtag.

Image manipulation library for PHP inspired by Python's PIL and other image libraries.

Requirements

The Imagine library has the following requirements:

  • PHP 7.1+

Older version of the library support also older PHP Version:

  • PHP 5.5 - 7.0 use version ^1.3
  • PHP 5.3 - 5.4 use version ^1.2

Depending on the chosen Image implementation, you may need one of the following PHP extensions:

  • GD2
  • Imagick (with ImageMagick version 6.2.9 or later, except version 7.0.7-32)
  • Gmagick

To read EXIF metadata (e.g. for autorotation), activate the PHP exif extension. This is optional: Imagine works without the PHP exif extension, but then it can't read and act on image orientation or other EXIF metadata.

Installation using composer

php composer.phar require imagine/imagine

Basic Principles

The main purpose of Imagine is to provide all the necessary functionality to bring all native low level image processing libraries in PHP to the same simple and intuitive OO API.

Several things are necessary to accomplish that:

  • Image manipulation tools, such as resize, crop, etc.
  • Drawing API - to create basic shapes and advanced charts, write text on the image
  • Masking functionality - ability to apply black&white or grayscale images as masks, leading to semi-transparency or absolute transparency of the image the mask is being applied to

The above tools should be the basic foundation for a more powerful set of tools that are called Filters in Imagine.

Some of the ideas for upcoming filters:

  • Charting and graphing filters - pie and bar charts, linear graphs with annotations
  • Reflection - apple style
  • Rounded corners - web 2.0

Documentation

Presentations

Articles

Contributing

Branches

New pull requests should be based on the develop branch. The master branch is the stable branch: it usually matches the latest a release but in can be a bit ahead.

Test groups

Some PHPUnit test is marked as skipped (for example, tests that require a driver that support multiple layers and executed with the GD driver). In addition, if you don't have installed gmagick, the gmagick tests will be marked as skipped.

If you don't want to run tests that are marked as "always skipped" you can tell PHPUnit to exclude the always-skipped group. The same for the tests that require a specific driver (gd, imagick, imagick).

So, for example, to exclude the always-skipped and the gmagick tests, you can launch phpunit with this command options:

composer run test -- --exclude-group always-skipped,gmagick

Development environment

Setting up an environment with all the required libraries may be very hard. In order to run the tests locally, you can use the same docker images used by Imagine to test the pull requests.

For example, if you have Imagine locally in the /home/me/imagine folder, you can run tests for PHP 8.1 with the GD and Imagick with this very simple approach:

  1. Launch a temporary docker container with:
    docker run --rm -it -v /home/me/imagine:/app -w /app ghcr.io/php-imagine/test:8.1-gd-imagick bash
  2. Inside the docker container, run these commands:
    # Start a local web server: some tests require it
    cd tests
    php -n -S 0.0.0.0:8013 >/dev/null 2>&1 &
    cd ..
    # Tell the tests that the local web server is available at the port 8013
    export IMAGINE_TEST_WEBSERVERURL=http://localhost:8013
    # Install the composer dependencies
    composer update
    # Run the tests
    composer run test -- --exclude-group always-skipped,gmagick

Note: This approach works on Windows too: simply launch the docker container with

docker run --rm -it -v C:\Path\To\Imagine:/app -w /app ghcr.io/php-imagine/test:8.1-gd-imagick bash

Built test files

Many tests create temporary files (in the tests/tmp directory) containing built images. Those temporary files are compared with expected images, and then are deleted. If you want to keep those temporary files (for example, to check what's being built), you can set the IMAGINE_TEST_KEEP_TEMPFILES environment variable. If the IMAGINE_TEST_KEEP_TEMPFILES is configured in the GitHub Action tests, those temporary files are attached to tests as an articact.

pixelandtonic/imagine 适用场景与选型建议

pixelandtonic/imagine 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.52M 次下载、GitHub Stars 达 13, 最近一次更新时间为 2016 年 11 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 3.52M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 13
  • 点击次数: 28
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 13
  • Watchers: 4
  • Forks: 529
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-11-28