定制 wiejakp/image-crop 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

wiejakp/image-crop

最新稳定版本:v1.0.7

Composer 安装命令:

composer require wiejakp/image-crop

包简介

Image cropping helper for PHP.

README 文档

README

Source Code Latest Version Software License PHP Version Build Status Coverage Status Total Downloads

This project adheres to a Contributor Code of Conduct. By participating in this project and its community, you are expected to uphold this code.

Installation

The preferred method of installation is via Composer. Run the following command to install the package and add it as a requirement to your project's composer.json:

composer require wiejakp/image-crop

Basic Usage

$imagePath = 'image.jpeg';
  
$imageCrop = (new ImageCrop())
   ->setReader(JPEGReader::class)
   ->setWriter(JPEGWriter::class);

// load resource into a reader
$imageCrop->getReader()->loadFromPath($imagePath);

// perform cropping actions
$imageCrop->crop();

// skip images that appear to be empty
if (false === $imageCrop->isEmpty()) {

   // save cropped image to the drive
   $imageCrop->getWriter()->write();

   // do stuff with $imageCrop->getData() or $imageCrop->getDataUri()
   $anchor = \sprintf('<a href="%s">anchor</a>', $imageCrop->getDataUri());
   ...
}

Reader And Writers

You can mix nad match what image resource is being loaded and what image resource is being generated out.

BMP Reader And Writer
$imageCrop = (new ImageCrop())
   ->setReader(BMPReader::class)
   ->setWriter(BMPWriter::class);
GIF Reader And Writer
$imageCrop = (new ImageCrop())
   ->setReader(GIFReader::class)
   ->setWriter(GIFWriter::class);
JPEG Reader And Writer
$imageCrop = (new ImageCrop())
   ->setReader(JPEGReader::class)
   ->setWriter(JPEGWriter::class);
PNG Reader And Writer
$imageCrop = (new ImageCrop())
   ->setReader(PNGReader::class)
   ->setWriter(PNGWriter::class);

Documentation

Check out the documentation website for detailed information and code examples.

Contributing

Contributions are welcome! Please read CONTRIBUTING for details.

Copyright and License

The wiejakp/ImageCrop library is copyright © Przemek Wiejak and licensed for use under the MIT License (MIT). Please see LICENSE for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-08-30