nahidz/imagex

Imagex 是一个便捷的图像处理库

dev-master 2014-02-26 19:28 UTC

This package is auto-updated.

Last update: 2024-08-29 04:19:48 UTC


README

Imagex 是 Laravel 4 的图像处理库。您可以通过缩放、宽度、高度以及宽度和高度的组合来调整图像大小。您还可以压缩图像。它非常方便且易于使用。

安装

在您的 main composer.json 文件的 "require" 部分添加以下内容:require: "nahidz/imagex": "dev-master"

使用终端中的 "composer update" 命令更新您的 composer

配置

在您的 Laravel 应用程序配置文件 app/config/app.php 的 "providers" 数组中添加以下内容

'Nahidz\Imagex\ImagexServiceProvider',

用法

语法:Imagex::load($photoName, $optionsArray)->action($parameter)->save();

动作列表

resizeToHeight($height)

resizeToWidth($width)

scale($scale)

resize($width, $height)

选项:$optionsArray 必须是一个数组,包含以下四个项

array( 'path'=>'where you want to save your image', 'name'=>'Which name you want to set is your image', 'compress'=>'compression value 0-100, its optional', 'permission'=>'permission code, its also optional' )

示例

Imagex::load('file', array('path'=>'public/images/', 'name'=> 'my_photo.jpg'))->resizeToWidth(480)->save();

就是这样。

谢谢 :)