定制 arf/imgur 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

arf/imgur

Composer 安装命令:

composer require arf/imgur

包简介

Imgur upload API with Laravel.

README 文档

README

Laravel-Imgur is super easy upload image to imgur package.

Laravel Imgur

::: warning This package was not maintenance. :::

<script async defer src="https://buttons.github.io/buttons.js"></script> Star Total Downloads Latest Stable Version License License

Introduction

Laravel Imgur is super easy upload image to imgur package.

Requirement

Version branch
5.x 1.0.x
6.x 1.0.x
7.x 1.1.x
8.x 2.x.x

Installation

$ composer require arf/imgur

Registering Service Provider

If you are using laravel 5.5 or later, you can use auto discover, you don't need put in service provider to app.php.

<?php
//app.php
'providers' => [
    Arf\Imgur\UploadServiceProvider::class,
],

Facade binding

'Imgur' => Arf\Imgur\Facades\Upload::class,

Publish config

$ php artisan vendor:publish

Usage

Imgur::upload($args);

Imgur::get($id);

Imgur::update($image, $id);

Imgur::delete($id);

Arguments can be a image link or file, for example, you can pass a link file or use file upload MUST instance of Illuminate\Http\UploadedFile .

Customize

If you want to customize your headers or form params, you can do belong:

Imgur::setHeaders([
    'headers' => [
        'authorization' => 'Client-ID ' . env('IMGUR_CLIENT_ID'),
        'content-type' => 'application/x-www-form-urlencoded',
    ]
])->setFormParams([
    'form_params' => [
        'image' => $image,
    ]
])->upload($image);

Quick Started

You can use methods to get what you want informations.

$image = Imgur::upload($file);

// Get imgur image link.
$image->link(); //"https://i.imgur.com/XN9m1nW.jpg"

// Get imgur image file size.
$image->fileszie(); //43180

// Get imgur image file type.
$image->type(); //"image/jpeg"

// Get imgur image width.
$image->width(); //480

// Get imgur image height.
$image->height(); //640

// Or you can get usual data.
$image->usual();

//[
//  'link' => "https://i.imgur.com/XN9m1nW.jpg",
//  'filesize' => 43180,
//  'type' => "image/jpeg",
//  'width' => 480,
//  'height' => 640,
//]

Sometimes, you need get more image size, you can call size to get more thumbnails.

$image = Imgur::upload($file);

// Support: https://api.imgur.com/models/image

// Get small square.
$small_square = Imgur::size($image->link(), 's');

// Get big square thumbbnail.
$small_square = Imgur::size($image->link(), 'b');

// Get small small thumbbnail.
$small_square = Imgur::size($image->link(), 't');

// Get small medium thumbbnail.
$small_square = Imgur::size($image->link(), 'm');

// Get small large thumbbnail.
$small_square = Imgur::size($image->link(), 'l');

// Get small huge thumbbnail.
$small_square = Imgur::size($image->link(), 'h');

统计信息

  • 总下载量: 150
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2021-08-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固