From f976362cc1a89550c8383c94112410a9c95cf0da Mon Sep 17 00:00:00 2001 From: Mark van Eijk Date: Thu, 11 Jan 2024 12:00:10 +0100 Subject: [PATCH] Update LaravelOpenGraphImageController.php --- .../Controllers/LaravelOpenGraphImageController.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Http/Controllers/LaravelOpenGraphImageController.php b/src/Http/Controllers/LaravelOpenGraphImageController.php index 118e3b8..7e6ff42 100644 --- a/src/Http/Controllers/LaravelOpenGraphImageController.php +++ b/src/Http/Controllers/LaravelOpenGraphImageController.php @@ -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)