canerdogan/imgproxy
Composer 安装命令:
composer require canerdogan/imgproxy
包简介
Laravel Service Provider for imgproxy: Resize your images instantly and securely
README 文档
README
img-proxy
Laravel Service Provider for Golang ImgProxy micro-service https://evilmartians.com/chronicles/introducing-imgproxy
Install
Works with Laravel 5.1 - 5.7 / PHP 7.0 - 7.2, probably 7.3 too
composer require canerdogan/imgproxy- copy the ServiceProvider to the providers array in config/app.php. Laravel 5.5 users with auto-discovery may skip this step
CanErdogan\ImgProxy\ImgProxyServiceProvider::class,
- copy the package config to your local config with the publish command:
php artisan vendor:publish --provider="CanErdogan\\ImgProxy\\ImgProxyServiceProvider"
-
to generate the secrets, you can use this command:
echo $(xxd -g 2 -l 64 -p /dev/random | tr -d '\n') -
env file:
# img-proxy.base_url IMGPROXY_URL=https://img-proxy-example.com # your img-proxy key IMGPROXY_KEY=943b421c9eb07c830af81030552c86009268de4e532ba2ee2eab8247c6da0881 # your img-proxy salt IMGPROXY_SALT=520f986b998545b4785e0defbc4f3c1203f22de2374a3d53cb7a7fe9fea309c5
This package does not cover the Authorization header.
Usage
helper:
imgProxy('https://www.nasa.gov/sites/default/files/images/528131main_PIA13659_full.jpg', 640, 360)
use CanErdogan\ImgProxy\Contracts\ImageSignatureInterface; use CanErdogan\ImgProxy\Image; Route::get('/img-test', function () { $path = 'https://www.nasa.gov/sites/default/files/images/528131main_PIA13659_full.jpg'; $width = 640; $height = 360; $pic = new Image; $pic->setOriginalPictureUrl($path) ->setWidth($width) ->setHeight($height) ->setResize('fit') ->setGravity('no') ->setEnlarge(0) ->setExtension('png'); app()->instance(Image::class, $pic); $signature = app(ImageSignatureInterface::class); echo ' Resized: <img src="' . config('img-proxy.base_url') . $signature->take() . '" alt="Resized"> <br> Original: <img src="' . $path . '" alt="Original"> '; });
canerdogan/imgproxy 适用场景与选型建议
canerdogan/imgproxy 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.2k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 03 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「image」 「proxy」 「resize」 「laravel」 「micro-service」 「imgproxy」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 canerdogan/imgproxy 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 canerdogan/imgproxy 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 canerdogan/imgproxy 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Lazy loading for middleware and request handlers
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
The Yii2 extension uses jQuery jquery.carousel-1.1.min.js and makes image carousel from php array of structure defined.
Image cache
The lireincore/imgcache integration for the Yii2 framework
The Yii2 extension uses jQuery PrettyPhoto and OwlCarousel js and makes image galary from php array of structure defined.
统计信息
- 总下载量: 2.2k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-30