mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 15:07:49 +00:00
feat ScreenGeneratorCommand, fix render endpoint
* feat: signature var `view` added to ScreenGeneratorCommand * fix: /display endpoint responds current screen image from db
This commit is contained in:
parent
17e5dfd70e
commit
309450e1b3
2 changed files with 6 additions and 3 deletions
|
|
@ -15,7 +15,7 @@ class ScreenGeneratorCommand extends Command
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'trmnl:screen:generate {deviceId=1}';
|
||||
protected $signature = 'trmnl:screen:generate {deviceId=1} {view=trmnl}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
|
@ -31,6 +31,7 @@ class ScreenGeneratorCommand extends Command
|
|||
{
|
||||
|
||||
$deviceId = $this->argument('deviceId');
|
||||
$view = $this->argument('view');
|
||||
|
||||
$uuid = Uuid::uuid4()->toString();
|
||||
$pngPath = public_path('storage/images/generated/').$uuid.'.png';
|
||||
|
|
@ -38,7 +39,7 @@ class ScreenGeneratorCommand extends Command
|
|||
|
||||
// Generate PNG
|
||||
try {
|
||||
Browsershot::html(view('trmnl')->render())
|
||||
Browsershot::html(view($view)->render())
|
||||
->windowSize(800, 480)
|
||||
->save($pngPath);
|
||||
} catch (\Exception $e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue