yoki/image

使用第三方仓库系统搭建图片存储仓库

This package's canonical repository appears to be gone and the package has been frozen as a result.

v0.0.1 2022-10-04 06:54 UTC

This package is not auto-updated.

Last update: 2025-04-02 17:20:06 UTC


README

搭建属于自己的图床系统

Gitee客户端使用方式

<?php
require_once 'vendor/autoload.php';

$config = [
    'GITEE_CLIENT_ID'      => 'd419e22******9097ce3', // app clinet_id
    'GITEE_CLIENT_SECRET'  => 'c296461******7a3cc73', // app client_secret
    'GITEE_USER_ID'        => '13**********4@13.com', // 授权用户账号
    'GITEE_USER_PASSWORD'  => 'l*****************70', // 授权用户密码
    'GITEE_USER_PATH'      => 'akss5768', // 授权用户空间名
    'GITEE_USER_REPO'      => 'image', // 授权用户仓库名
    'GITEE_USER_BASE_PATH' => '/', // 图墙路径,相对路径
    'GITEE_BRANCH'         => 'master', // 提交分支
];

// 文件上传
$pathName = 'MyFile/';
$fileName = date('Y-m-d H:i:s') . '.txt';
$content  = date('Y-m-d H:i:s') . ' Hello,world';

// 图片上传
$image    = 'https://i0.hdslb.com/bfs/archive/fd85e7b5b601e31f7ba8723fd384170f9d48b15f.png';
$pathName = 'MyImage/';
$fileName = date('Y-m-d H:i:s') . '.png';
$content  = file_get_contents($image);
$message  = '上传';

$giteeClient = new Yoki\Image\Client\Gitee($config);

$giteeClient->addFile($pathName, $fileName, $content, $message);