定制 lmkhang10/lara_thumbnail 二次开发

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

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

lmkhang10/lara_thumbnail

Composer 安装命令:

composer require lmkhang10/lara_thumbnail

包简介

Generating thumbnail in laravel basing intervention Image

README 文档

README

This package can be installed through Composer.

composer require LaraX/thumbnail

Laravel Setup

When using Laravel, if you are using a version pre v5.5 you will need to include the Service Provider manually:

// app/config/app.php

'providers' => [
    // ...
    'LaraX\Screenshots\LaraXProvider'
];

Setup your API keys:

// config/larax.php

'THUMBNAIL'  =>  [
    'PREFIX'        =>  'thumbnail_',
    'SIZE'          =>  [
        'width'     =>  267,
        'height'    => null
    ]
];

and in your .env file:

# THUMBNAIL
GENERATE_THUMBNAIL=TRUE

Usage

Here is a sample call to generate a LaraXThumbnail screenshot URL:

    use LaraX\Thumbnail\LaraXThumbnail;
    $LaraXThumbnail = new LaraXThumbnail();
    $thumbnailUrl = $LaraXThumbnail->makeThumbnail(storage_path('app/public/'. $folder .$newFileName), $folder, 'public', 'thumbnail_', 240);
    
    // Generate a screenshot by loading the Urlbox URL in an img tag:
    echo '<img src="' . $thumbnailUrl . '" alt="Test thumbnail generated">'

If you're using Laravel and have set up the service provider, you can use the Facade provided:

use LaraX\Thumbnail\LaraXThumbnail;

// Create the thumbnail URL
$LaraXThumbnail = new LaraXThumbnail();
$thumbnailUrl = $laraXThumbnail->makeThumbnail(storage_path('app/public/'. $folder .$newFileName), $folder, 'public', 'thumbnail_', 240);

You can now use the result ($thumbnailUrl) by placing it inside an <img/> tag as the src parameter.

Contributing

We are open to pull requests.

Security

If you discover any security related issues, please email barryle89@gmail.com instead of using the issue tracker.

About LaraXThumbnail

Generating thumbnail in laravel basing intervention Image

License

The MIT License (MIT).

统计信息

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

GitHub 信息

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

其他信息

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