Skip to content

Commit

Permalink
Merge branch 'laravel-11' of github.com:vormkracht10/laravel-open-gra…
Browse files Browse the repository at this point in the history
…ph-image into laravel-11
  • Loading branch information
Baspa committed Mar 7, 2024
2 parents 815c1a7 + 22ec893 commit 354bcf6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Http/Controllers/LaravelOpenGraphImageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct()

public function __invoke(Request $request)
{
if (!app()->environment('local') && !$request->hasValidSignature()) {
if (! app()->environment('local') && ! $request->hasValidSignature()) {
abort(403);
}

Expand All @@ -48,7 +48,7 @@ public function __invoke(Request $request)
return $html;
}

if (!$this->getStorageFileExists($request->signature)) {
if (! $this->getStorageFileExists($request->signature)) {
$this->saveOpenGraphImage($html, $request->signature);
}

Expand All @@ -67,12 +67,12 @@ public function getStoragePath()

public function getStorageFileName($signature)
{
return $signature . '.' . $this->imageExtension;
return $signature.'.'.$this->imageExtension;
}

public function getStorageFilePath($filename)
{
return $this->getStoragePath() . '/' . $this->getStorageFileName($filename);
return $this->getStoragePath().'/'.$this->getStorageFileName($filename);
}

public function getStorageFileData($filename)
Expand All @@ -97,7 +97,7 @@ public function getImageType()

public function ensureDirectoryExists()
{
if (!File::isDirectory($this->getStoragePath())) {
if (! File::isDirectory($this->getStoragePath())) {
File::makeDirectory($this->getStoragePath(), 0777, true);
}
}
Expand Down Expand Up @@ -135,7 +135,7 @@ public function saveOpenGraphImage($html, $filename)
public function getOpenGraphImageResponse($filename)
{
return response($this->getStorageFileData($filename), 200, [
'Content-Type' => 'image/' . $this->getImageType(),
'Content-Type' => 'image/'.$this->getImageType(),
]);
}
}

0 comments on commit 354bcf6

Please sign in to comment.