eden/image
Composer 安装命令:
composer require eden/image
包简介
Eden image component.
README 文档
README
====
Install
composer install eden/image
====
Introduction
Instantiate image in this manner.
$image = eden('image', '/path/to/image.jpg');
Once you are done modifying the image you can save the image to a file or simply echo out the image object like below.
header('Content-Type: image/jpg');
echo $image;
====
API
====
blur
Applies the selective blur filter. Blurs the image
Usage
eden('image', '/path/to/image.jpg')->blur();
Parameters
Returns Eden\Image\Index
====
brightness
Applies the brightness filter. Changes the brightness of the image.
Usage
eden('image', '/path/to/image.jpg')->brightness(*number $level);
Parameters
*number $level- The level of brightness
Returns Eden\Image\Index
Example
eden('image', '/path/to/image.jpg')->brightness($level);
====
colorize
Applies the colorize filter. Like greyscale except you can specify the color.
Usage
eden('image', '/path/to/image.jpg')->colorize(*number $red, *number $blue, *number $green, number $alpha);
Parameters
*number $red- The 255 value of red to use*number $blue- The 255 value of blue to use*number $green- The 255 value of green to usenumber $alpha- The level of alpha transparency
Returns Eden\Image\Index
Example
eden('image', '/path/to/image.jpg')->colorize($red, $blue, $green);
====
contrast
Applies the contrast filter. Changes the contrast of the image.
Usage
eden('image', '/path/to/image.jpg')->contrast(*number $level);
Parameters
*number $level- The level of contrast
Returns Eden\Image\Index
Example
eden('image', '/path/to/image.jpg')->contrast($level);
====
crop
Crops the image
Usage
eden('image', '/path/to/image.jpg')->crop(int|null $width, int|null $height);
Parameters
int|null $width- The width; If null will use the original widthint|null $height- The height; If null will use the original height
Returns Eden\Image\Index
Example
eden('image', '/path/to/image.jpg')->crop();
====
edgedetect
Applies the edgedetect filter. Uses edge detection to highlight the edges in the image.
Usage
eden('image', '/path/to/image.jpg')->edgedetect();
Parameters
Returns Eden\Image\Index
====
emboss
Applies the emboss filter. Embosses the image.
Usage
eden('image', '/path/to/image.jpg')->emboss();
Parameters
Returns Eden\Image\Index
====
gaussianBlur
Applies the gaussian blur filter. Blurs the image using the Gaussian method.
Usage
eden('image', '/path/to/image.jpg')->gaussianBlur();
Parameters
Returns Eden\Image\Index
====
getDimensions
Returns the size of the image
Usage
eden('image', '/path/to/image.jpg')->getDimensions();
Parameters
Returns array
====
getResource
Returns the resource for custom editing
Usage
eden('image', '/path/to/image.jpg')->getResource();
Parameters
Returns [RESOURCE]
====
greyscale
Applies the greyscale filter. Converts the image into grayscale.
Usage
eden('image', '/path/to/image.jpg')->greyscale();
Parameters
Returns Eden\Image\Index
====
invert
Inverts the image.
Usage
eden('image', '/path/to/image.jpg')->invert(bool $vertical);
Parameters
bool $vertical- If true invert vertical; if false invert horizontal
Returns Eden\Image\Index
Example
eden('image', '/path/to/image.jpg')->invert();
====
meanRemoval
Applies the mean removal filter. Uses mean removal to achieve a "sketchy" effect.
Usage
eden('image', '/path/to/image.jpg')->meanRemoval();
Parameters
Returns Eden\Image\Index
====
negative
Applies the greyscale filter. Reverses all colors of the image.
Usage
eden('image', '/path/to/image.jpg')->negative();
Parameters
Returns Eden\Image\Index
====
resize
Resizes the image. This is a version of scale but keeping it's original aspect ratio
Usage
eden('image', '/path/to/image.jpg')->resize(int|null $width, int|null $height);
Parameters
int|null $width- the width; if null will use the original widthint|null $height- the height; if null will use the original height
Returns Eden\Image\Index
Example
eden('image', '/path/to/image.jpg')->resize();
====
rotate
Rotates the image.
Usage
eden('image', '/path/to/image.jpg')->rotate(*int $degree, int $background);
Parameters
*int $degree- The degree to rotate byint $background- Background color code
Returns Eden\Image\Index
Example
eden('image', '/path/to/image.jpg')->rotate(123);
====
scale
Scales the image. If width or height is set to null a width or height will be auto determined based on the aspect ratio
Usage
eden('image', '/path/to/image.jpg')->scale(int|null $width, int|null $height);
Parameters
int|null $width- The width; if null will use the original widthint|null $height- The height; if null will use the original height
Returns Eden\Image\Index
Example
eden('image', '/path/to/image.jpg')->scale();
====
setTransparency
Sets the background color to be transparent
Usage
eden('image', '/path/to/image.jpg')->setTransparency();
Parameters
Returns Eden\Image\Index
====
smooth
Applies the smooth filter. Makes the image smoother.
Usage
eden('image', '/path/to/image.jpg')->smooth(*number $level);
Parameters
*number $level- The level of smoothness
Returns Eden\Image\Index
Example
eden('image', '/path/to/image.jpg')->smooth($level);
====
save
Saves the image data to a file
Usage
eden('image', '/path/to/image.jpg')->save(*string $path, string|null $type);
Parameters
*string $path- The path to save tostring|null $type- The render type
Returns Eden\Image\Index
Example
eden('image', '/path/to/image.jpg')->save('foo');
====
Contributions to Eden are following the Github work flow. Please read up before contributing.
##Setting up your machine with the Eden repository and your fork
- Fork the repository
- Fire up your local terminal create a new branch from the
v4branch of your fork with a branch name describing what your changes are. Possible branch name types:- bugfix
- feature
- improvement
- Make your changes. Always make sure to sign-off (-s) on all commits made (git commit -s -m "Commit message")
##Making pull requests
- Please ensure to run
phpunitbefore making a pull request. - Push your code to your remote forked version.
- Go back to your forked version on GitHub and submit a pull request.
- An Eden developer will review your code and merge it in when it has been classified as suitable.
eden/image 适用场景与选型建议
eden/image 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.53k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2013 年 09 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「library」 「eden」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 eden/image 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 eden/image 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 eden/image 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Eden generic model component
Eden generic collection component
Eden MySQL Search, Collection, Model ORM component
Eden SQLite Search, Collection, Model ORM componen
Eden template component.
Eden PostGreSQL Search, Collection, Model ORM component
统计信息
- 总下载量: 8.53k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 10
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-09-24