php-collective/file-storage-image-processor 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

php-collective/file-storage-image-processor

最新稳定版本:1.0.0

Composer 安装命令:

composer require php-collective/file-storage-image-processor

包简介

File Storage Image Processor

README 文档

README

CI Software License

Image Processing for the File Storage Library.

Built on top of Intervention Image v3.

Features

  • Manipulates images and produces variants of the original image and stores them
  • Supports multiple image operations: resize, scale, crop, rotate, flip, sharpen, and more
  • Optimizes image file size using spatie/image-optimizer
  • Works with League Flysystem for flexible storage backends
  • Fluent API for chaining image operations

Requirements

  • PHP 8.1 or higher
  • GD or Imagick extension
  • Intervention Image v3

Installation

composer require php-collective/file-storage-image-processor

Quick Example

use PhpCollective\Infrastructure\Storage\Processor\Image\ImageVariantCollection;

$collection = ImageVariantCollection::create();

// Create a thumbnail with aspect ratio preserved
$collection->addNew('thumbnail')
    ->scale(300, 300)
    ->optimize();

// Create a specific-sized avatar
$collection->addNew('avatar')
    ->cover(150, 150)
    ->optimize();

$file = $file->withVariants($collection->toArray());
$file = $imageProcessor->process($file);

Documentation

Please start by reading the documentation in the docs/ directory:

Upgrade from v2

This package uses Intervention Image v3, which has breaking changes from v2:

  • ImageManager now requires a Driver instance instead of array configuration
  • The resize() method no longer has an aspectRatio parameter
  • Use scale() for aspect ratio preservation (recommended for most cases)
  • Use resize() only when you need exact dimensions (may distort image)

See the Available Operations documentation for detailed examples.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-14