Giter VIP home page Giter VIP logo

free-pic's Introduction

free-pic 一个第三方免费图床扩展包

体验demo

github 地址

packagist 地址

feature

  • 三无图床("无存储限制" | "无需上传凭证" | "无同源跨域检测")
  • 简单易用、方便扩展
  • 支持 常见 "gif", "jpeg", "jpg", "png" 图片格式

支持图床

使用

下载安装

composer require hzz/free-pic dev-master

上传图片到第三方图床 (完整调用过程)

// 配置项
$config = [
    'sm' => [ // sm 需要token ,不使用可无须配置
        "token" => "Yuc4fb0BuwsOnd4y7R0zFp0tVGkxYgRa22"
    ],
    'debug' => true,
    'log' => [
        'name' => 'img_hosting',
        'file' => __DIR__ . '/img_hosting.log',
        'level' => 'debug',
        'permission' => 0777,
    ],
];

$params = [
    "filepath" => "图片的绝对路径",
];
// 实例化
$freePic = new \Hzz\FreePic($config);
// 上传 , 同理 可用 ->sm , ->freeImageHost , ->catBox 调用对应的服务
$res = $freePic->imgBB->upload($params); // 这里返回的是对应图床服务器返回的上传结果数据。
// getUrl方法 可获取实际
$url = $freePic->imgBB->getUrl($res);

详细用法可参考 tests 用例 或 upload.php

License

MIT

free-pic's People

Contributors

hezhizheng avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.