From: Vincent Vanwaelscappel Date: Tue, 18 Feb 2025 20:06:12 +0000 (+0100) Subject: wip #7340 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=28246d5f4b2f71bb629eae1544f411b3874cbb18;p=fluidbook-toolbox.git wip #7340 @0.5 --- diff --git a/app/Fluidbook/Compiler/Compiler.php b/app/Fluidbook/Compiler/Compiler.php index 024029e12..e41ea995c 100644 --- a/app/Fluidbook/Compiler/Compiler.php +++ b/app/Fluidbook/Compiler/Compiler.php @@ -362,8 +362,9 @@ class Compiler extends Base implements CompilerInterface, IVirtualDirectoryError $this->width = round($this->getFluidbook()->getPageWidth(), 8); $this->height = round($this->getFluidbook()->getPageHeight(), 8); - $this->imageFormat =$this->getFluidbook()->getImageFormat(); - $this->fluidbookSettings->set('imageFormat',$this->imageFormat); + $this->imageFormat = $this->getFluidbook()->getImageFormat(); + $this->transparent = $this->getSetting('transparentPage'); + $this->fluidbookSettings->set('imageFormat', $this->imageFormat); $p1 = $this->getFluidbook()->getFile(1, $this->imageFormat, 150); $imagesize = Image::getimagesize($p1); diff --git a/app/Fluidbook/Compiler/Images.php b/app/Fluidbook/Compiler/Images.php index 6e657a3bf..9df28a9a9 100644 --- a/app/Fluidbook/Compiler/Images.php +++ b/app/Fluidbook/Compiler/Images.php @@ -58,7 +58,7 @@ trait Images $resolutions = $this->getResolutions(); - $cacheKey = 'imagesToCopy_' . $this->imageFormat . '_' . md5(json_encode($resolutions)); + $cacheKey = 'imagesToCopy_' . $this->imageFormat . '_' . ($this->transparent ? 'transparent' : 'opaque') . '_' . md5(json_encode($resolutions)); $cacheKey .= '-' . $this->config->JPEGQuality; $cacheKey .= '//' . md5(json_encode($this->config->rasterizePages)); $cacheKey .= '||' . md5(json_encode($this->config->vectorPages)); @@ -83,7 +83,7 @@ trait Images foreach ($resolutions as $r) { foreach ($thisbackgroundPrefix as $backgroundsPrefix) { - $source = $this->getFluidbook()->getFile($page, $this->imageFormat, $r, $backgroundsPrefix, true, $imdir); + $source = $this->getFluidbook()->getFile($page, $this->imageFormat, $r, $backgroundsPrefix, true, $this->transparent, $imdir); $filesToCopy[$source] = 'data/background/' . $r . '/' . ($backgroundsPrefix ? 't' : 'p') . $page . '.' . $this->imageFormat; } } diff --git a/app/Models/FluidbookPublication.php b/app/Models/FluidbookPublication.php index 49c7cbc5a..637e6c00f 100644 --- a/app/Models/FluidbookPublication.php +++ b/app/Models/FluidbookPublication.php @@ -454,11 +454,10 @@ class FluidbookPublication extends ToolboxStatusModel } - public function getFile($page, $format = 'jpg', $resolution = 150, $withText = true, $withGraphics = true, $version = 'html', $force = false) + public function getFile($page, $format = 'jpg', $resolution = 150, $withText = true, $withGraphics = true, $transparent = false, $version = 'html', $force = false) { $compo = $this->getComposition()[$page]; - $res = self::_getDocument($compo[0])->getFile($compo[1], $format, $resolution, $this->JPEGQuality, $withText, $withGraphics, $version, $force); - return $res; + return self::_getDocument($compo[0])->getFile($compo[1], $format, $resolution, $this->JPEGQuality, $withText, $withGraphics, $transparent, $version, $force); }