fix overlapping pages on PDF thumbnail generation

This commit is contained in:
2024-05-04 14:42:23 +10:00
parent 3358cf8dea
commit 6a76dacdae
2 changed files with 13 additions and 1 deletions

View File

@@ -158,7 +158,12 @@ class GenerateVariants implements ShouldQueue
$height = $variantData['thumbnail']['height'];
$manager = new ImageManager(new Driver());
$image = $manager->read($temp);
$imagick = new \Imagick();
$imagick->readImage($temp . '[0]'); // Read the first page of the PDF
$imagick->setImageFormat('png');
$image = $manager->read($imagick);
$image->scaleDown($width, $height);
$variantFile = $tempDir . '/' . $media->hash . '-thumbnail.webp';