mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-13 06:56:48 +00:00
seo image added
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Contracts\Filesystem\Filesystem;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use League\Glide\Responses\LaravelResponseFactory;
|
||||
use League\Glide\ServerFactory;
|
||||
|
||||
@@ -12,18 +14,24 @@ class ImageController extends Controller
|
||||
* Handle the incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function __invoke(Filesystem $filesystem, $path)
|
||||
public function __invoke(Request $request, Filesystem $filesystem, $path)
|
||||
{
|
||||
if (str($request->path())->contains('img-public')) {
|
||||
$filesystemPublic = Storage::disk('publicDisk');
|
||||
}
|
||||
|
||||
$server = ServerFactory::create([
|
||||
'response' => new LaravelResponseFactory(app('request')),
|
||||
'source' => $filesystem->getDriver(),
|
||||
'cache' => $filesystem->getDriver(),
|
||||
'response' => new LaravelResponseFactory(app('request')),
|
||||
'source' => str($request->path())->contains('img-public') ? $filesystemPublic->getDriver() : $filesystem->getDriver(),
|
||||
'cache' => $filesystem->getDriver(),
|
||||
'cache_path_prefix' => '.cache',
|
||||
'base_url' => 'img',
|
||||
'base_url' => $request->route()
|
||||
->getName() === 'imgPublic' ? '' : 'img',
|
||||
]);
|
||||
|
||||
return $server->getImageResponse('public/'.$path, request()->all());
|
||||
return $server->getImageResponse($path, request()->all());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ class Welcome extends Component
|
||||
'SEOData' => new SEOData(
|
||||
title: __('Welcome'),
|
||||
description: __('Welcome to the portal of the Einundzwanzig Community.'),
|
||||
image: asset('img/screenshot.png')
|
||||
image: url()->route('imgPublic', ['path' => 'img/screenshot.png', 'h' => 630, 'w' => 1200, 'fit' => 'crop'])
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,11 @@ class InternArticleView extends Component
|
||||
title: $this->libraryItem->name,
|
||||
description: strip_tags($this->libraryItem->excerpt) ?? __('Here we post important news that is relevant for everyone.'),
|
||||
author: $this->libraryItem->lecturer->name,
|
||||
image: $this->libraryItem->getFirstMedia('main') ? $this->libraryItem->getFirstMediaUrl('main') : asset('img/einundzwanzig-wallpaper-benrath.png'),
|
||||
image: $this->libraryItem->getFirstMedia('main')
|
||||
? $this->libraryItem->getFirstMediaUrl('main', 'seo')
|
||||
: url()->route('imgPublic', [
|
||||
'path' => 'img/einundzwanzig-wallpaper-benrath.png', 'h' => 630, 'w' => 1200, 'fit' => 'crop'
|
||||
]),
|
||||
published_time: Carbon::parse($this->libraryItem->created_at),
|
||||
type: 'article',
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user