Skip to content

Commit

Permalink
Update LaravelOpenGraphImageController.php
Browse files Browse the repository at this point in the history
  • Loading branch information
markvaneijk authored Jan 11, 2024
1 parent 16cea9a commit f976362
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Http/Controllers/LaravelOpenGraphImageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,22 @@ public function ensureDirectoryExists()

public function getScreenshot($html, $filename)
{
return Browsershot::html($html)
$browsershot = Browsershot::html($html)
->noSandbox()
->showBackground()
->windowSize($this->imageWidth, $this->imageHeight)
->setScreenshotType($this->getImageType(), $this->imageQuality)
->screenshot($this->getStorageFilePath($filename));

if(config('open-graph-image.paths.node')) {
$browsershot = $browsershot->setNodeBinary(config('open-graph-image.paths.node'));
}

if(config('open-graph-image.paths.npm')) {
$browsershot = $browsershot->setNpmBinary(config('open-graph-image.paths.npm'));
}

return $browsershot;
}

public function saveOpenGraphImage($html, $filename)
Expand Down

0 comments on commit f976362

Please sign in to comment.