定制 inweb/media 二次开发

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

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

inweb/media

最新稳定版本:9.0.6

Composer 安装命令:

composer require inweb/media

包简介

Media components for InWeb framework

README 文档

README

Media files manipulation

Requirements

  • Laravel >=5.7

Installation

  1. Install package via composer require
    composer require inweb/media
    
    or add to your composer.json to require section and update your dependencies
    "inweb/media": "*"
    
  2. Run migrations
    php artisan migrate
    

You are ready to go!

Usage

Add trait to your model (InWeb\Base\Entity)

use InWeb\Media\WithImages;

For thimbnails implement method:

use InWeb\Media\Thumbnail;

...

public function getImageThumbnails()
{
    return [
        'catalog' => new Thumbnail(function (\Intervention\Image\Image $image) {
            return $image->resize(100, 100, function (Constraint $c) {
                $c->aspectRatio();
                $c->upsize();
            })->resizeCanvas(100, 100);
        }, true),
    ];
}

Thumbnail class receives 2 parameters:

  1. Closure with \Intervention\Image\Image object
  2. Boolean - Only for main image (default - false)

You can specify original thumbnail name to manipulate with original image.

public function getImageThumbnails()
{
    return [
        'original' => new Thumbnail(...),
    ];
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-07-22