Social Media Image Kit will fire events at various points during the image generation process. You may listen for these events if you need to respond to them to implement more complex logic:
The GeneratingImage
event is fired right before a social media image kit generates an image. The event object will have the following properties:
$entry
: The entry the image will be generated for.
$size
: The details from the configuration file for the current image, such as the social media platform, height, width, as well as any additional metadata.
1<?php 2 3namespace Stillat\SocialMediaImageKit\Events; 4 5use Illuminate\Foundation\Events\Dispatchable; 6 7class GeneratingImage 8{ 9 use Dispatchable;10 11 public function __construct(12 public readonly object $entry,13 public readonly array $size14 ) {15 }16}
The ImageGenerated
event is fired right after a social media image has been generated. The event object will have the following properties:
$entry
: The entry the image will be generated for.
$size
: The details from the configuration file for the current image, such as the social media platform, height, width, as well as any additional metadata.
1<?php 2 3namespace Stillat\SocialMediaImageKit\Events; 4 5use Illuminate\Foundation\Events\Dispatchable; 6 7class GeneratedImage 8{ 9 use Dispatchable;10 11 public function __construct(12 public readonly object $entry,13 public readonly array $size14 ) {15 }16}
The GenerationFailed
event is fired if the image generation process failed for any reason. The event object will have the following properties:
$entry
: The entry the image will be generated for.
$size
: The details from the configuration file for the current image, such as the social media platform, height, width, as well as any additional metadata.
1<?php 2 3namespace Stillat\SocialMediaImageKit\Events; 4 5use Illuminate\Foundation\Events\Dispatchable; 6 7class GenerationFailed 8{ 9 use Dispatchable;10 11 public function __construct(12 public readonly object $entry,13 public readonly array $size14 ) {15 }16}
The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.