From 9f99599d8395238f05e7147e326aa81321afdcec Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 7 Sep 2021 20:26:36 +0200 Subject: [PATCH] wip #4666 @2 --- .../Controllers/Admin/ToolsController.php | 26 +++++++++++++++++++ .../Controllers/Tools/FluidbookConvert.php | 14 ++++++++++ app/Jobs/ProcessFluidbook.php | 18 ++++++++++--- .../views/tools/fluidbookconvert.blade.php | 4 +++ routes/web.php | 2 +- 5 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 app/Http/Controllers/Admin/ToolsController.php create mode 100644 app/Http/Controllers/Tools/FluidbookConvert.php create mode 100644 resources/views/tools/fluidbookconvert.blade.php diff --git a/app/Http/Controllers/Admin/ToolsController.php b/app/Http/Controllers/Admin/ToolsController.php new file mode 100644 index 0000000..9aa6a68 --- /dev/null +++ b/app/Http/Controllers/Admin/ToolsController.php @@ -0,0 +1,26 @@ + $args]); + } + return $this->$tool($args); + } +} diff --git a/app/Http/Controllers/Tools/FluidbookConvert.php b/app/Http/Controllers/Tools/FluidbookConvert.php new file mode 100644 index 0000000..2ff33f0 --- /dev/null +++ b/app/Http/Controllers/Tools/FluidbookConvert.php @@ -0,0 +1,14 @@ +job instanceof SyncJob); + + start_measure('Process Fluidbook'); $this->resetOutput(); - $this->processPages(); + $this->processPages($sync); $this->getTexts(); $this->getLinks(); $this->writeConfig(); + stop_measure('Process Fluidbook'); } protected function resetOutput() { + start_measure("Reset Fluidbook Output"); $stub = resource_path('fluidbook/'); $cmd = "rm -rfv $this->out;cp -rv $stub $this->out"; `$cmd`; + stop_measure("Reset Fluidbook Output"); } - public function processPages() + public function processPages($sync = false) { + start_measure('Process Pages'); $out = storage_path('fluidbook/convert/' . $this->in->getHash()); $this->in->processPages($out, [ ['format' => 'jpg', 'resolution' => '36', 'withTexts' => true, 'withGraphics' => true], ['format' => 'jpg', 'resolution' => '150', 'withTexts' => false, 'withGraphics' => true], - ['format' => 'jpg', 'resolution' => '300', 'withTexts' => false, 'withGraphics' => true], + // ['format' => 'jpg', 'resolution' => '300', 'withTexts' => false, 'withGraphics' => true], ['format' => 'svg', 'resolution' => '300', 'withTexts' => true, 'withGraphics' => false], - ]); + ], $sync); + stop_measure('Process Pages'); + } public function getTexts() diff --git a/resources/views/tools/fluidbookconvert.blade.php b/resources/views/tools/fluidbookconvert.blade.php new file mode 100644 index 0000000..c62a2be --- /dev/null +++ b/resources/views/tools/fluidbookconvert.blade.php @@ -0,0 +1,4 @@ +@extends(backpack_view('blank')) + +@section('content') +@endsection diff --git a/routes/web.php b/routes/web.php index 9f058cd..1725466 100644 --- a/routes/web.php +++ b/routes/web.php @@ -7,5 +7,5 @@ Route::group([ 'middleware' => ['web', config('backpack.base.middleware_key', 'admin')], 'namespace' => '\App\Http\Controllers\Admin', ], function () { // custom admin routes - //Route::any('tools/{tool}/{args?}', 'ToolsController@index')->where(['args' => '.*']); + Route::any('tools/{tool}/{args?}', 'ToolsController@index')->where(['args' => '.*']); }); -- 2.39.5