boomdraw/laravel-dummy-image
Composer 安装命令:
composer require boomdraw/laravel-dummy-image
包简介
Laravel dummy image generator based on kingkool68/dummyimage
README 文档
README
This package allows you to generate dynamic dummy image in Laravel framework.
It's based on the Russell Heimlich's dummy image generator
Once installed you can do stuff like this:
// Generate and store an image DummyImage::put($path, $disk); // Generate and return image as response DummyImage::toResponse($code, $headers); // Generate and return image as base64 DummyImage::toBase64($code, $headers);
Installation
Laravel
You can install the package via composer:
composer require boomdraw/laravel-dummy-image
You can publish the config file with:
php artisan vendor:publish --provider="BoomDraw\DummyImage\DummyImageServiceProvider" --tag="config"
When published, the config/dummyimage.php config file contains:
return [ /* * Default disk for generated image */ 'disk' => 'local', /* * Default path for generated image */ 'path' => 'dummyimage', /* * Additional headers for response */ 'headers' => [ // ], /* * Additional html color names with hex value for name to hex convertation */ 'color_names' => [ //'color_name' => '00ffff' ], ];
Usage
// Generate an image with custom params $image = DummyImage::generate($dimensions = '200x1:5', $format = 'gif', $bg_color = 'ff00cc', $fg_color = '00ffcc', $text = 'I am image text'); // Generate and store an image $image->put($path, $disk); // Generate and return image as response $image->toResponse($code, $headers); // Generate and return image as base64 string $image->toBase64($code, $headers);
If any of the methods will be used without generate() one, an image will be generated with default params.
You can provide your own parameters for generating image:
- $dimensions - image dimensions.
You can provide as dimensions image size and/or ratio. By default used '800x600'.
Examples:
'800x600' will generate an image with width 800px and height 600px
'800' will generate an image with 800px width and height
'250x1:2' will generate an image with 250px width and 500px height
'1:3x300' will generate an image with width 100px and height 300px - $format - generated image format ('jpg', 'gif', 'png'). Default format is 'png'.
- $bg-color - image background color in hex. Default is white ('ffffff').
- $fg_color - image text color in hex. Default is black ('000000').
- $text variable provides text that will be written on the image. Default is image dimensions.
Resources
License
The MIT License (MIT).
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
boomdraw/laravel-dummy-image 适用场景与选型建议
boomdraw/laravel-dummy-image 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.56k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 08 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「image」 「laravel」 「Dummy」 「boomdraw」 「laravel-dummy-image」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 boomdraw/laravel-dummy-image 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 boomdraw/laravel-dummy-image 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 boomdraw/laravel-dummy-image 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
Dummy / fake data generator for modern PHP
Mocks, stubs, and spies for PHP.
Phony for Kahlan.
The Yii2 extension uses jQuery jquery.carousel-1.1.min.js and makes image carousel from php array of structure defined.
Mock Object library
统计信息
- 总下载量: 1.56k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-08-17