shitric/cloudflare-images
Composer 安装命令:
composer require shitric/cloudflare-images
包简介
A simple PHP class for CloudFlare Images CDN
README 文档
README
A simple PHP class for CloudFlare Images CDN.
Dependencies
- PHP 7.3+
- cURL Library
Installation
With composer
composer require shitric/cloudflare-images
Manual
- Download the Images.php file from src
- Include your project with require or require_once functions. Choose what if you want.
Usage
Creating new instance.
You can get the construct parameters from your CloudFlare account.
$cloudFlareImages = new Images('Account_ID', 'API_Token', 'Images_Hash', 'Domain');
Image Uploading
I highly recommend using it with the try-catch block. Because this method throws Exception for cURL.
- 3rd parameter for delete image file after the uploading. Default value is
false. - 4th parameter for metadata. Default value is
[]. - 5th parameter for custom ID (max 1024 alpha-numeric chars). Default is
''and lets Cloudflare generate the image ID. See Cloudflare Docs
Returns Image ID for getting the uploaded image from CDN
$imageId = $cloudFlareImages->uploadImageFile('File_Path', 'File_Name', false, ['key'=>'value'], 'Custom_ID');
Getting the Uploaded Image URL
Just give the Image ID and it will returns the direct Image url. Second parameter for image variant. Default is public.
$cloudFlareImages->getImageUrl('Image_ID', 'Variant');
Deleting the Image from CDN
Returns True or False.
$cloudFlareImages->deleteImage('Image_ID');
shitric/cloudflare-images 适用场景与选型建议
shitric/cloudflare-images 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.1k 次下载、GitHub Stars 达 20, 最近一次更新时间为 2022 年 05 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 shitric/cloudflare-images 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 shitric/cloudflare-images 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3.1k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 20
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-05-09