]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6781 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 8 Mar 2024 15:24:52 +0000 (16:24 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 8 Mar 2024 15:24:52 +0000 (16:24 +0100)
app/Console/Commands/FluidbookFluidbookPageProcess.php [new file with mode: 0644]

diff --git a/app/Console/Commands/FluidbookFluidbookPageProcess.php b/app/Console/Commands/FluidbookFluidbookPageProcess.php
new file mode 100644 (file)
index 0000000..9ca1231
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Console\Commands\Base\ToolboxCommand;
+use App\Jobs\FluidbookDocumentUpload;
+use App\Models\FluidbookDocument;
+use App\Models\FluidbookPublication;
+use App\Models\User;
+use Cubist\Util\PHP;
+use Cubist\Util\Str;
+use Illuminate\Support\Facades\Log;
+
+class FluidbookFluidbookPageProcess extends ToolboxCommand
+{
+    protected $signature = 'fluidbook:process:page {id} {page}';
+    protected $description = 'Reprocess a fluidbook document';
+
+    /**
+     * @throws \Exception
+     */
+    public function handle()
+    {
+        PHP::neverStop(true);
+        $id = $this->argument('id');
+        /** @var FluidbookPublication $fluidbook */
+        $fluidbook = FluidbookPublication::withoutGlobalScopes()->find($id);
+        $files = [
+            // Thumbnail
+            ['jpg', 'thumb', true, true, ''],
+            // Images
+            ['jpg', 150, false, true, 'html'],
+            // Texts
+            ['svg', 150, true, false, 'html'],
+        ];
+
+        foreach ($files as $file) {
+            $fluidbook->getFile($this->argument('page'), $file[0], $file[1], $file[2], $file[3], $file[4], true);
+        }
+    }
+}