PHP code example of vormkracht10 / laravel-open-graph-image
1. Go to this page and download the library: Download vormkracht10/laravel-open-graph-image library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vormkracht10 / laravel-open-graph-image example snippets
return [
'extension' => 'jpg',
'quality' => 100,
'width' => 1200,
'height' => 630,
// The cache location to use.
'storage' => [
'disk' => 'public',
'path' => 'open-graph',
],
// Whether to use the browse URL instead of the HTML input.
// This is slower, but makes fonts available.
// Alternative: http
'method' => 'html',
'metatags' => [
'og:title' => 'title',
'og:description' => 'description',
'og:type' => 'type',
'og:url' => 'url',
],
];
// Facade
use Backstage\OgImage\Laravel\Facades\OgImage;
$url = OgImage::url(['title' => 'Backstage', 'subtitle' => '...']);
// or using the `og()` helper
$url = og(['title' => 'Backstage', 'subtitle' => '...']);