ktquez/lumen-image 问题修复 & 功能扩展

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

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

ktquez/lumen-image

最新稳定版本:v1.0.2

Composer 安装命令:

composer require ktquez/lumen-image

包简介

Image manipulation library Lumen Framework based on Imagine and inspired by Croppa for easy url based manipulation

README 文档

README

Lumen Image is an image manipulation package for Lumen framework adapted from Folklore - Laravel image and based on the PHP Imagine library. It is inspired by Croppa as it can use specially formatted urls to do the manipulations. It supports basic image manipulations such as resize, crop, rotation and flip. It also supports effects such as negative, grayscale, gamma, colorize and blur. You can also define custom filters for greater flexibility.

Latest Stable Version Total Downloads License

Credits:

This package is an adaptation of image manipulation library created by Folklore - Laravel image for lumen framework.

The main difference between this package and other image manipulation libraries is that you can use parameters directly in the url to manipulate the image. A manipulated version of the image is then saved in the same path as the original image, creating a static version of the file and bypassing PHP for all future requests.

For example, if you have an image at this URL:

/uploads/photo.jpg

To create a 300x300 version of this image in black and white, you use the URL:

/uploads/photo-image(300x300-crop-grayscale).jpg

To help you generate the URL to an image, you can use the Image::url() method

Image::url('/uploads/photo.jpg',300,300,array('crop','grayscale'));

or

<img src="<?=Image::url('/uploads/photo.jpg',300,300,array('crop','grayscale'))?>" />

Alternatively, you can programmatically manipulate images using the Image::make() method. It supports all the same options as the Image::url() method.

Image::make('uploads/photo.jpg',array(
    'width' => 300,
    'height' => 300,
    'grayscale' => true
))->save('path/to/the/thumbnail.jpg');

or use directly the Imagine library

$thumbnail = Image::open('uploads/photo.jpg')
            ->thumbnail(new Imagine\Image\Box(300,300));

$thumbnail->effects()->grayscale();

$thumbnail->save('path/to/the/thumbnail.jpg');

Features

This package use Imagine for image manipulation. Imagine is compatible with GD2, Imagick, Gmagick and supports a lot of features.

This package also provides some common filters ready to use (more on this):

  • Resize
  • Crop (with position)
  • Rotation
  • Black and white
  • Invert
  • Gamma
  • Blur
  • Colorization

Installation

Dependencies: Server Requirements: Installation:
composer require ktquez/lumen-image
configuration:

Inside the file bootstrap/app.php and insert the following lines

$app->configure('image');

$app->register('Folklore\Image\ImageServiceProvider');

class_alias('Folklore\Image\Facades\Image','Image');

If you want to use dependency injection, just add this code in your file 'AppServiceProvider.php'

$this->app->bind('\Folklore\Image\ImageManager', function($app) {
    return $app['image'];
});

Documentation

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 25
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-07-02