davidcb/laravel-shortpixel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

davidcb/laravel-shortpixel

最新稳定版本:0.3.2

Composer 安装命令:

composer require davidcb/laravel-shortpixel

包简介

Laravel 5+ package for ShortPixel API integration

README 文档

README

Laravel 5+ wrapper for ShortPixel API

Installation

Install via Composer:

composer require davidcb/laravel-shortpixel

If you're using Laravel >= 5.5, you can skip this as this package will be auto-discovered. Add the service provider to config/app.php

Davidcb\LaravelShortPixel\LaravelShortPixelServiceProvider::class,

You can register the facade in the aliases array in the config/app.php file

'LaravelShortPixel' => Davidcb\LaravelShortPixel\Facades\Esendex::class,

Publish the config file

$ php artisan vendor:publish --provider="Davidcb\LaravelShortPixel\LaravelShortPixelServiceProvider"

Set your API key on your .env file

SHORT_PIXEL_API_KEY=secret

Usage

You can find all the methods in the original short-pixel-optimizer/shortpixel-php package.

Examples:

// From URL
$result = LaravelShortPixel::fromUrls('https://your.site/img/unoptimized.png', '/path/to/save/to'[, 'filename.png', $compression_level = 1, $width = 200, $height = 200, $maxDimension = true]);
// From file
$result = LaravelShortPixel::fromFiles('/path/to/your/local/unoptimized.png', '/path/to/save/to'[, $compression_level = 1, $width = 200, $height = 200, $maxDimension = true]);
// From files
$result = LaravelShortPixel::fromFiles(array('/path/to/your/local/unoptimized.png', '/path/to/your/local/unoptimized2.png'), '/path/to/save/to'[, $compression_level = 1, $width = 200, $height = 200, $maxDimension = true]);
// From folder
$result = LaravelShortPixel::fromFolder('/path/to/your/local/folder', '/path/to/save/to'[, $compression_level = 1, $width = 200, $height = 200, $maxDimension = true]);

The compression_level, width, height and maxDimension are optional. Compression levels are 0 - loseless, 1 - lossy, 2- glossy. Default compression level for your images is set on the configuration file (lossy is set as default).

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-10-09