--- /dev/null
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use App\Http\Controllers\Controller;
+use App\Http\Controllers\Tools\FluidbookConvert;
+
+class ToolsController extends Controller
+{
+ use FluidbookConvert;
+
+ protected function index($tool, $args = '')
+ {
+
+ if (!$args) {
+ $args = [];
+ } else {
+ $args = explode('/', $args);
+ }
+
+ if (!method_exists($this, $tool)) {
+ return view('tools.' . $tool, ['args' => $args]);
+ }
+ return $this->$tool($args);
+ }
+}
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\Jobs\SyncJob;
use Illuminate\Queue\SerializesModels;
class ProcessFluidbook implements ShouldQueue, ShouldBeUnique
*/
public function handle()
{
+ $sync = ($this->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()
'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' => '.*']);
});