feat: Optimize image handling for OnTicket tenant
- Added migration to optimize OnTicket images using OptimizeOnticketImagesSeeder. - Updated OnTicketTenantSeeder to reference optimized image formats (AVIF). - Modified OnticketImmersiveHeroCarouselSeeder to use AVIF images for hero carousel. - Created OptimizeOnticketImagesSeeder to replace existing attachments with optimized images. - Adjusted TestEventsSeeder to utilize AVIF images for events. - Updated tests to verify the correct image formats and ensure optimized images are stored. - Added new image files in AVIF format for logos, backgrounds, and event images.
This commit is contained in:
@@ -14,6 +14,8 @@ use RuntimeException;
|
||||
|
||||
class OnTicketTenantSeeder extends Seeder
|
||||
{
|
||||
private const IMAGE_DIRECTORY = 'images/tennants/onticket_otpimizado';
|
||||
|
||||
public function __construct(
|
||||
private readonly TenantProvisioningService $tenantProvisioningService,
|
||||
private readonly WebsiteExtraService $websiteExtraService,
|
||||
@@ -49,7 +51,7 @@ class OnTicketTenantSeeder extends Seeder
|
||||
'header_logo' => $this->uploadedImage('onticket_logo.png'),
|
||||
'footer_logo' => $this->uploadedImage('onticket_footer_logo.png'),
|
||||
'favicon' => $this->uploadedImage('onticket_favicon.svg'),
|
||||
'header_bg_image' => $this->uploadedImage('onticket_header_background.png'),
|
||||
'header_bg_image' => $this->uploadedImage('onticket_header_background.avif'),
|
||||
]);
|
||||
} else {
|
||||
$tenant->update([
|
||||
@@ -64,7 +66,7 @@ class OnTicketTenantSeeder extends Seeder
|
||||
'header_logo' => ['relation' => 'headerLogo', 'filename' => 'onticket_logo.png'],
|
||||
'footer_logo' => ['relation' => 'footerLogo', 'filename' => 'onticket_footer_logo.png'],
|
||||
'favicon' => ['relation' => 'favicon', 'filename' => 'onticket_favicon.svg'],
|
||||
'header_bg_image' => ['relation' => 'headerBackgroundImage', 'filename' => 'onticket_header_background.png'],
|
||||
'header_bg_image' => ['relation' => 'headerBackgroundImage', 'filename' => 'onticket_header_background.avif'],
|
||||
] as $field => $image) {
|
||||
$attachment = $tenant->{$image['relation']};
|
||||
|
||||
@@ -98,7 +100,7 @@ class OnTicketTenantSeeder extends Seeder
|
||||
|
||||
private function uploadedImage(string $filename): UploadedFile
|
||||
{
|
||||
$path = public_path("images/tennants/onticket/{$filename}");
|
||||
$path = public_path(self::IMAGE_DIRECTORY."/{$filename}");
|
||||
|
||||
if (! is_file($path)) {
|
||||
throw new RuntimeException("Image not found at path: {$path}");
|
||||
@@ -106,6 +108,7 @@ class OnTicketTenantSeeder extends Seeder
|
||||
|
||||
$mimeType = match (strtolower(pathinfo($filename, PATHINFO_EXTENSION))) {
|
||||
'svg' => 'image/svg+xml',
|
||||
'avif' => 'image/avif',
|
||||
default => 'image/png',
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user