Customizations
You can change the default disk on which the generated medias are being stored by changing the config file or updating your environment file. By default the generated images will be stored in the public disk. You may change it by updating the config file as follows.
/*
* The disk on which to store added files and derived images by default. Choose
* one of the disks you've configured in config/filesystems.php.
*/
'disk_name' => env('OG_IMAGE_DISK', 'custom_disk'),
or by adding an environment variable to your .env file.
OG_IMAGE_DISK=custom_disk
You may want to change the directory to which the generated images are being stored. To do this, you can update the config file as follows.
/*
* You can specify a prefix for that is used for storing all media. If you set this
* to `/og-images`, all your media will be stored in a `/og-images` directory.
*/
'media_prefix' => env('OG_IMAGE_MEDIA_PREFIX', '/custom-directory'),
Or by updating your environment file as follows
OG_IMAGE_MEDIA_PREFIX='/custom-directory'
You can get total control over how your open graph images are being generated by using your own view to generate the images. To do this, add your own view to the config file as below.
/*
* The path of the view template file that will
* be used to generate the open graph image.
* */
'view_path' => 'web.print.graphify-image'
By doing this, Graphify will look for a view in
resources/views/web/print/graphify-image.blade.php
When you are within your custom view, you will have access to your model view
$model
variable. So if you want to display anything like title, author name or published time, you can do so as follows.<div>
<div>{{ $model->title }}</div>
<div>{{ $model->author?->name}}</div>
<div>{{ $model->published_at?->format('d M Y') }}</div>
</div>
You can also chose how you want to name the saved files. To do this, just override the following method on your model.
public function getGraphifyFileName(): string
{
return $this->slug . '.png';
}