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:
@@ -11,6 +11,8 @@ use RuntimeException;
|
||||
|
||||
class TestEventsSeeder extends Seeder
|
||||
{
|
||||
private const IMAGE_DIRECTORY = 'images/tennants/onticket_otpimizado/test-events';
|
||||
|
||||
public function __construct(private readonly AttachmentService $attachmentService) {}
|
||||
|
||||
public function run(): void
|
||||
@@ -24,7 +26,7 @@ class TestEventsSeeder extends Seeder
|
||||
'subtitle' => 'Una noche para cantar y bailar',
|
||||
'description' => 'Evento de prueba para explorar la cartelera de OnTicket.',
|
||||
'location' => 'Teatro Broadway, Rosario',
|
||||
'image' => 'live-music.png',
|
||||
'image' => 'live-music.avif',
|
||||
'weeks_from_now' => [2],
|
||||
'time_start' => '21:00:00',
|
||||
'time_end' => '23:30:00',
|
||||
@@ -35,7 +37,7 @@ class TestEventsSeeder extends Seeder
|
||||
'subtitle' => 'Gastronomía y música para toda la familia',
|
||||
'description' => 'Evento de prueba con dos jornadas disponibles.',
|
||||
'location' => 'Parque de España, Rosario',
|
||||
'image' => 'food-festival.png',
|
||||
'image' => 'food-festival.avif',
|
||||
'weeks_from_now' => [3, 3],
|
||||
'day_offsets' => [0, 1],
|
||||
'time_start' => '12:00:00',
|
||||
@@ -47,7 +49,7 @@ class TestEventsSeeder extends Seeder
|
||||
'subtitle' => 'Humor para compartir',
|
||||
'description' => 'Evento de prueba para visualizar distintas propuestas.',
|
||||
'location' => 'Centro Cultural La Comedia, Rosario',
|
||||
'image' => 'stand-up.png',
|
||||
'image' => 'stand-up.avif',
|
||||
'weeks_from_now' => [4],
|
||||
'time_start' => '20:30:00',
|
||||
'time_end' => '22:00:00',
|
||||
@@ -74,14 +76,14 @@ class TestEventsSeeder extends Seeder
|
||||
}
|
||||
|
||||
if ($event->attachment_id === null) {
|
||||
$path = public_path('images/tennants/onticket/test-events/'.$definition['image']);
|
||||
$path = public_path(self::IMAGE_DIRECTORY.'/'.$definition['image']);
|
||||
|
||||
if (! is_file($path)) {
|
||||
throw new RuntimeException("Image not found at path: {$path}");
|
||||
}
|
||||
|
||||
$attachment = $this->attachmentService->store(
|
||||
new UploadedFile($path, $definition['image'], 'image/png', null, true),
|
||||
new UploadedFile($path, $definition['image'], 'image/avif', null, true),
|
||||
'tenants/onticket/events',
|
||||
);
|
||||
$event->update(['attachment_id' => $attachment->id]);
|
||||
|
||||
Reference in New Issue
Block a user