shitric/cloudflare-images
最新稳定版本:v1.1
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');
统计信息
- 总下载量: 1.31k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 21
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-05-09