定制 thapp/image 二次开发

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

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

thapp/image

Composer 安装命令:

composer require thapp/image

包简介

Image processor

README 文档

README

Build Status Code Climate Coverage Status HHVM Status Latest Stable Version Latest Unstable Version License

This module was created for the usage in Thapp\JitImage, but can be used as a standalone library for manipulating images. It's highly inspired by the Imagine library, but resolves a views flaws, but also way more limited.

Installation

Require thapp/image in your project directory

$ composer require thapp/image

or add this to your composer.json

{
	"require": {
		"thapp/image": "dev-master"
	}
}

Usage

Quick Example

<?php

use Thapp\Image\Geometry\Size;
use Thapp\Image\Driver\Imagick\Source;

$source = new Source;
$image = $source->load('image.jpg');

$image->edit()->crop(new Size(100, 100));

$image->save('newimage.jpg');

Loading sources

The Source object is able to create Image instances from either filepaths, filehandles, or binary strings:

<?php

use Thapp\Image\Driver\Imagick\Source;

$source = new Source;
$image = $source->load('image.jpg');
// or read the file from a file handle:
$handle = fopen('image.jpg', 'r+');
$image = $source->read($handle);
// or read the file from a binary string:
$content = file_get_contents('image.jpg');
$image = $source->create($content);

The Source class takes an instance of Thapp\Image\Info\MetaDataReaderInterface as its first argument. The $reader is used to read meta information about the image. This is useful e.g. if you want to autorotate the image based on its orientation.

By default, a new instance of Thapp\Image\Info\ImageReader is created for you. ImageReader is capable of reading basic image information derived from the php getimagesize() function.

You may use the Thapp\Image\Info\ImageReader class instead, which provides a wider range of information (e.g. needed for GD and Gmagick drivers to determine the correct image orientation).

<?php

use Thapp\Image\Info\ExifReader;
use Thapp\Image\Driver\Imagick\Source;

$source = new Source(new ExifReader);

// ...

$image = $source->load('image.jpg');

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-05-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固