orchestra / imagine
Imagine (包装器) 组件用于 Laravel
v6.0.0
2021-04-17 17:16 UTC
Requires
- php: ^7.3 || ^8.0
- imagine/imagine: ^1.2
- orchestra/support-core: ^6.0
- orchestra/support-providers: ^6.0
Requires (Dev)
- orchestra/testbench: ^6.19
This package is auto-updated.
Last update: 2024-09-18 00:28:36 UTC
README
Imagine (包装器) 组件是 Laravel 的包装器,用于Imagine。
版本兼容性
安装
要通过 composer 安装,请在终端中运行以下命令
composer require "orchestra/imagine"
配置
在 config/app.php
中添加 Orchestra\Imagine\ImagineServiceProvider
服务提供者。
'providers' => [ // ... Orchestra\Imagine\ImagineServiceProvider::class, ],
在 config/app.php
中添加 Imagine
别名。
'aliases' => [ // ... 'Imagine' => Orchestra\Imagine\Facade::class, ],
使用方法
以下是一个简单的示例,说明如何从一个图像创建缩略图
<?php use Imagine\Image\ImageInterface; use Orchestra\Imagine\Jobs\CreateThumbnail; dispatch(new CreateThumbnail([ 'path' => $path, 'filename' => $filename, // filename without extension 'extension' => $extension, 'format' => '{filename}.thumb.{extension}', 'dimension' => 320, // width and height will be 320. 'mode' => ImageInterface::THUMBNAIL_OUTBOUND, 'filter' => ImageInterface::FILTER_UNDEFINED, ]));