alexantr/image-resize
最新稳定版本:v2.3.0
Composer 安装命令:
composer require alexantr/image-resize
包简介
Image resizing library
README 文档
README
Image resizing library. Creates images on demand using GD.
Install
Install through Composer:
composer require alexantr/image-resize
Examples
See full list of examples in example folder.
Creating URLs:
use Alexantr\ImageResize\Image; $src1 = Image::init('uploads/pic.jpg')->crop(200, 200); $src2 = Image::init('uploads/pic.jpg')->silhouette()->quality(95)->fit(200, 200); $src3 = Image::init('uploads/pic.jpg')->fitWidth(200); $src4 = Image::init('uploads/pic.jpg')->fitHeight(200); $src5 = Image::init('/site/uploads/pic.jpg')->bgColor('6af')->fill(200, 200);
Can use class member access on instantiation in PHP 5.4 or higher:
<img src="<?= (new Image('uploads/pic.jpg'))->crop(200, 200) ?>" alt="">
Creator example
Apache .htacces file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^resized/(.*)$ image.php?path=$1 [L]
image.php in web root folder:
require '../vendor/autoload.php'; $webroot = __DIR__; $path = isset($_GET['path']) ? $_GET['path'] : ''; Alexantr\ImageResize\Creator::create($webroot, $path);
统计信息
- 总下载量: 1.26k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-10-17