phplegends/thumb-laravel

该包已被 废弃 且不再维护。未建议替代包。

Laravel 中创建图片缩略图的包

1.0.4 2016-04-20 02:49 UTC

This package is auto-updated.

Last update: 2021-01-09 18:15:13 UTC


README

#PHPLegends/ThumbLaravel

本包为 Laravel 中图片缩略图创建提供了一种简单的方法。

#安装

composer.json 中添加包名,并运行 composer update

"require" : {
	"phplegends/thumb-laravel" : "1.*"
}

在您的 config/app.php 文件中添加

'PHPLegends\ThumbLaravel\ThumbServiceProvider'

并使用 Facade 类

'alias' => array(
    'Thumb' => 'PHPLegends\ThumbLaravel\Facade'
)

用于创建图片缩略图

Thumb::image('img/logo.png', $width, $height)

默认情况下,输出目录设置为 public/_thumbs。如需更改,请修改 app/config/packages/phplegends/thumb-laravel/config.php 文件。

return array(
	'folder' => 'my_thumb_directory'
)

之后,所有缩略图都保存在 public/my_thumb_directory 中。

要创建不缓存的图片缩略图,请使用 Thumb::image('url', 50, 50, false)