kvnc/cache-images
Composer 安装命令:
composer require kvnc/cache-images
包简介
This package adds image cache to laravel
README 文档
README
Introduction
Welcome to my first laravel library
This library has 2 configs which sets original file paths and filters (resizing templates)
* Mapping key represent where the original image file placed
* Example you store your blog images into uploads/blogs
* Then your mapping should be like 'mapping' => [
* "blogs" => "uploads/blogs"
* ]
* blogs key represent the module parameter of your route , This means when you send blogs module parameter
* Library will search under uploads/blogs to find original file
*/
'mapping' => [
],
/**
* Filters key represent the resizing width and height of template
* such as 'thumb' => ['width' => 100 ,'height' => 100 ]
*/
'filters' => [
]
As you can see above you should set mapping and filters attributes of cache-image config file.
###How to install
composer require kvnc/cache-images
Run this command on your terminal at the root of your laravel project
##Configure To publish config file you should do vendor publish action
php artisan vendor:publish --provider=Kvnc\CacheImages\CacheImageProvider
Then set config file And set your image file name eg duplicated.jpg to duplicated+jpg and send to route
you can use our helper function to send file on route
function getResizedImageUrl($filter,$module,$image_url): string
{
$image = implode('+',explode('.',basename($image_url)));
return route('kvnc_image_cache.cache',['filter'=>$filter,'module' => $module, 'filename'=> $image]);
}
Call getResizedImageUrl in any image tag you need
Have fun Thanks for reading
kvnc/cache-images 适用场景与选型建议
kvnc/cache-images 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 35 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 09 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 kvnc/cache-images 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kvnc/cache-images 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 35
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-09-24