]> _ Git - fluidbook-toolbox.git/commitdiff
wip #7340 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 18 Feb 2025 20:06:12 +0000 (21:06 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 18 Feb 2025 20:06:12 +0000 (21:06 +0100)
app/Fluidbook/Compiler/Compiler.php
app/Fluidbook/Compiler/Images.php
app/Models/FluidbookPublication.php

index 024029e12fbe850d208abb84df0a83b8b14a07dc..e41ea995c621f07a8f3178657586e8af435bfeae 100644 (file)
@@ -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);
index 6e657a3bfbad5aec138c9116e6cb022798b8cec8..9df28a9a98e68ab5cfb72fb014db52b76ef1b602 100644 (file)
@@ -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;
                     }
                 }
index 49c7cbc5a15ed96f5455484cafa5b79cc194c26a..637e6c00fdf1607ecd58c841109617306563e0dd 100644 (file)
@@ -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);
     }