定制 davidcb/laravel-shortpixel 二次开发

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

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

davidcb/laravel-shortpixel

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).

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固