simexis / webthumb
该软件包最新版本(2.0.0)没有提供许可证信息。
2.0.0
2019-05-01 12:28 UTC
Requires
- php: >=5.6.0
This package is auto-updated.
Last update: 2024-08-29 04:45:24 UTC
README
这是一个PHP库,用于使用PhantomJS进行屏幕截图。
只需要在中间执行phantomjs命令,非常容易配置。
Laravel 5.3的Webthumb类
要求
- Laravel 5.3
- php 5.6+
安装
步骤1:使用 Composer 安装包
composer require simexis/webthumb
步骤2:Laravel 5.5+
如果您不使用自动发现,请在config/app.php中将ServiceProvider添加到providers数组中
Simexis\Webthumb\WebthumbServiceProvider::class,
用法
默认配置是
$cfg = [ 'local_cache_dir' => public_path() . "/thumbs", //relative cache directory must exists in install directory and rwx permissions to all (777) 'phantom_js_root' => __DIR__ . '/../lib/phantomjs', //Path to the root directory phantom_js 'encoding' => "png", // jpg or png 'bwidth' => "1280", // browser width 'bheight' => "1024" // browser height only for mode=screen ];
基本示例
echo \Webthumb::setUrl('http://google.com')->save($save_path);
echo (new \Webthumb) ->setURL('http://google.com') ->setScreenWidth('1024') ->setScreenHeight('768') ->save($save_path);