jscustom/laravel-image-resize
Composer 安装命令:
composer require jscustom/laravel-image-resize
包简介
Laravel package for resizing images. Supports PNG, JPG, JPEG, GIF.
README 文档
README
Laravel package for resizing images. Supports PNG, JPG, JPEG, GIF.
Table of Contents
Getting Started
Installation
How to Use
Download Postman API
Image Resize
Sample Image Resize API
How To Implement Image Resize Service
Common Issues Encountered
Support
Getting Started
Below are the steps in order to integrate image resize API to your Laravel project.
Installation
Install the package using composer:
composer require jscustom/laravel-image-resize
Export the configuration file:
php artisan vendor:publish --provider="JSCustom\ImageResize\Providers\ImageResizeServiceProvider" --tag="config"
How To Use
Download Postman API
Download the Postman API Collection here.
Image Resize
Features
- Resize
- Crop
- Change Quality
Service
JSCustom\ImageResize\Services\ImageResizeService
Sample Image Resize API
Controller
JSCustom\ImageResize\Http\Controllers\ImageResize\ImageResizeController
URL
{{url}}/api/image-resize
Form Data
{
"image": `FILE`,
"width": 150,
"height": 150,
"quality": 75,
"option": "crop"
}
Method
POST
Headers
{
"Content-Type": "multipart/form-data"
}
Response
{
"status": true,
"code": 201,
"message": "Image has been created. Please see PUBLIC\\PATH\\OF\\RESIZED\\IMAGE\\2141667567259_DSC05028-Edit_FB.jpg",
"payload": {
"image": "PUBLIC\\PATH\\OF\\RESIZED\\IMAGE\\2141667567259_DSC05028-Edit_FB.jpg"
}
}
How To Implement Image Resize Service
Add the service to your controller
use JSCustom\ImageResize\Services\ImageResizeService;
In your controller, follow this code structure
$image = ImageResizeService::imageResize($request);
Or initiate in the construct of your controller
public function __construct( \JSCustom\ImageResize\Services\ImageResizeService $ImageResizeService ) { $this->_imageResizeService = $ImageResizeService; }
Then follow this code structure
$image = $this->_imageResizeService->imageResize($request);
Common Issues Encountered
GD error(s)
For PHP8.0 use (php8.1-gd and php8.2-gd are also available):
sudo apt-get install php8.0-gd
For PHP7.0 use (php7.1-gd, php7.2-gd, php7.3-gd and php7.4-gd are also available):
sudo apt-get install php7.0-gd
Support
For support, email developer.jeddsaliba@gmail.com.
jscustom/laravel-image-resize 适用场景与选型建议
jscustom/laravel-image-resize 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 20 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 11 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jscustom/laravel-image-resize 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jscustom/laravel-image-resize 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-11-03