]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6188 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 8 Sep 2023 16:29:51 +0000 (18:29 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 8 Sep 2023 16:29:51 +0000 (18:29 +0200)
app/Models/FluidbookDocument.php

index 7ec5a3927a3ad68115565a47cb129f6d6deb9379..8d98dc0e02c3b31ced3da860323dc839e4bd53cc 100644 (file)
@@ -12,6 +12,7 @@ use Cubist\Backpack\Magic\Fields\Text;
 use Cubist\Backpack\Magic\Fields\Textarea;
 use Cubist\PDF\CommandLine\FWSTK;
 use Cubist\PDF\PDFTools;
+use Cubist\Util\Files\Files;
 use Cubist\Util\Gzip;
 use Cubist\Util\Math;
 use Illuminate\Support\Facades\Cache;
@@ -208,7 +209,7 @@ class FluidbookDocument extends ToolboxModel
         if (!$path) {
             $res .= DIRECTORY_SEPARATOR;
         }
-        return $res;
+        return Files::mkdir($res);
     }
 
     public function hasFile($page, $format = 'jpg', $resolution = 150, $quality = 85, $withText = true, $withGraphics = true, $version = 'html', $forceCheck = false)
@@ -231,7 +232,7 @@ class FluidbookDocument extends ToolboxModel
                 return false;
             }
             if ($format === 'svg') {
-                $reffile = $this->path('/html/fp' . $page . '.svg');
+                $reffile = $this->path('/html/').'fp' . $page . '.svg';
                 if (!file_exists($reffile) || filemtime($path) < filemtime($reffile)) {
                     return false;
                 }
@@ -380,8 +381,8 @@ class FluidbookDocument extends ToolboxModel
 
     public function _getHightlightFilePath($page, $mode = 'standard')
     {
-        $dir = $mode !== 'standard' ? '/' . $mode : '';
-        return $this->path('texts' . $dir . '/p' . $page . '.fby');
+        $dir = $mode !== 'standard' ? $mode . '/' : '';
+        return $this->path('texts/' . $dir ). 'p' . $page . '.fby';
     }
 
     public function _getTextPath($page, $type = self::TEXT_PLAIN, $mode = 'standard', $extractionMethod = 'fluidbook', $ignoreSeparators = '')
@@ -392,13 +393,13 @@ class FluidbookDocument extends ToolboxModel
         }
 
         $prefix = self::_getTextFilePrefix($extractionMethod);
-        $dir = $mode !== 'standard' ? '/' . $mode : '';
-        return $this->path('texts/' . $dir . $sepFolder . $prefix . $type . $page . '.txt');
+        $dir = $mode !== 'standard' ? $mode . '/' : '';
+        return $this->path('texts/' . $dir . $sepFolder  ).$prefix . $type . $page . '.txt';
     }
 
     public function getPDFSource($type = 'crop'): string
     {
-        return $this->path($type . '.pdf');
+        return $this->path().$type . '.pdf';
     }
 
     public function cutDocument($mode)