[composer package] free-pic free picture bed

藏色散人
Release: 2020-11-02 13:47:24
forward
2740 people have browsed it

The following tutorial column ofcomposerwill introduce to you about [composer package] free-pic free picture bed, I hope it will be helpful to friends in need!

free-pic Free Picture Bed

Experience demo(http://free-pic.hzz.cool/upload.html)

github address (https://github.com/hezhizheng/free-pic)

packagist address (https://packagist.org/packages/ hzz/free-pic)

feature

  • 三无图 beds (No storage limit | No need to upload credentials | No origin cross-domain detection )
  • Supports using proxy, easy to use, easy to expand
  • Supports "gif", "jpeg", "jpg", "png" image formats

support image bed

  • https://sm.ms/
  • https://imgkr.com/
  • https:// imgbb.com/upload
  • ...If you find other three-no-picture beds, then expand them

##Use

to download and install

composer require "hzz/free-pic @dev"
Copy after login
Upload pictures to local

... use Hzz\File; // 上传图片到本地 , 也可使用其他上传类,最终获取图片的绝对路径即可 $fileEntity = File::singleton(); // $field_name 上传图片的字段名称 默认 file // $dir 指定上传路径 默认 '' $filepath = $fileEntity->upload($field_name,$dir);
Copy after login

Upload pictures to third-party picture bed

// 通过不同类型初始化实现类 // 支持参数类型(img_kr、sm、img_bb) $serve = FreePic::create('img_kr'); // $serve->proxy = 'http://127.0.0.1:58591'; // 按需设置代理、sm.ms在移动网络下可能需要fq $url = $serve->upload($filepath);
Copy after login

Delete local pictures

$fileEntity->delete($filepath);
Copy after login

For detailed usage, please refer to tests use case

The above is the detailed content of [composer package] free-pic free picture bed. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!