]> _ Git - odl.git/commitdiff
wip #4666 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 6 Sep 2021 18:09:06 +0000 (20:09 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 6 Sep 2021 18:09:06 +0000 (20:09 +0200)
app/Jobs/ProcessFluidbook.php
composer.json
composer.lock

index 57ea47d51cda0c61506ba83e0f7619cdb939cb6e..3cacc9d84350b0ddf93b7c675ac8d5bfd318a3a6 100644 (file)
@@ -3,6 +3,8 @@
 namespace App\Jobs;
 
 use Cubist\Util\CommandLine;
+use Fluidbook\Tools\FluidbookTools;
+use Fluidbook\Tools\PDF\Document;
 use Illuminate\Bus\Queueable;
 use Illuminate\Contracts\Queue\ShouldBeUnique;
 use Illuminate\Contracts\Queue\ShouldQueue;
@@ -14,13 +16,12 @@ class ProcessFluidbook implements ShouldQueue, ShouldBeUnique
 {
     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
 
+    /**
+     * @var Document
+     */
     protected $in;
     protected $out;
 
-    protected $pages;
-    protected $width;
-    protected $height;
-
     /**
      * Create a new job instance.
      *
@@ -28,7 +29,7 @@ class ProcessFluidbook implements ShouldQueue, ShouldBeUnique
      */
     public function __construct()
     {
-        $this->in = storage_path('fluidbook/in/');
+        $this->in = new Document(storage_path('fluidbook/in/in.pdf'));
         $this->out = storage_path('fluidbook/out/');
     }
 
@@ -40,8 +41,7 @@ class ProcessFluidbook implements ShouldQueue, ShouldBeUnique
     public function handle()
     {
         $this->resetOutput();
-        $this->getInfos();
-        $this->pdfToImages();
+        $this->processPages();
         $this->getTexts();
         $this->getLinks();
         $this->writeConfig();
@@ -54,29 +54,16 @@ class ProcessFluidbook implements ShouldQueue, ShouldBeUnique
         `$cmd`;
     }
 
-    public function getInfos()
-    {
-        $fwstk = new CommandLine(base_path('tools/fwstk.sh'));
-        $fwstk->setArg('--input ' . $this->in . 'in.pdf');
-        $fwstk->setArg('--infos');
-        $fwstk->execute();
-
-        $infos = $fwstk->getOutput();
-
-        if (preg_match('/Pages:\s*(\d+)/', $infos, $matches)) {
-            $this->pages = (int)$matches[1];
-        }
-        if (preg_match('/Page 1 size:\s*([0-9.]+)[ptsx\s]+([0-9.]+)/', $infos, $matches)) {
-            $this->width = (float)$matches[1];
-            $this->height = (float)$matches[2];
-        }
-
-        file_put_contents($this->in . '/infos.txt', $infos);
-    }
 
-    public function pdfToImages()
+    public function processPages()
     {
-
+        $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' => 'svg', 'resolution' => '300', 'withTexts' => true, 'withGraphics' => false],
+        ]);
     }
 
     public function getTexts()
index 7156ab220d762e03aa7782848288b5102ef5c769..e6b3f40c19e690e56d2319e746cbf888a899d3c5 100644 (file)
     ],
     "license": "MIT",
     "require": {
-        "php": "^7.3|^8.0",
+        "php": "^8.0",
         "ext-json": "*",
+        "ext-redis": "*",
         "ext-simplexml": "*",
         "ext-tidy": "*",
         "ext-zip": "*",
-        "ext-redis": "*",
         "cubist/cms-back": "dev-master",
+        "fluidbook/tools": "dev-master",
         "fruitcake/laravel-cors": "^2.0",
         "guzzlehttp/guzzle": "^7.3",
         "laravel/framework": "^8.58",
index bbc2d2f5459be4ebc99eda3de13886dce7099d9d..47eddfd9ac92178adf777f1d2521cea884aa79ce 100644 (file)
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "90fd3102e33006c8e1bfaef9432159d3",
+    "content-hash": "c743f32a801dc0c163a83f8f0ff687b3",
     "packages": [
         {
             "name": "asm89/stack-cors",
         },
         {
             "name": "backpack/crud",
-            "version": "4.1.51",
+            "version": "4.1.52",
             "source": {
                 "type": "git",
                 "url": "https://github.com/Laravel-Backpack/CRUD.git",
-                "reference": "756173cf6593c3d530fca0e54831763c796e24d8"
+                "reference": "239e60df0436f8a817facce20a2dffcb2b6e7250"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/Laravel-Backpack/CRUD/zipball/756173cf6593c3d530fca0e54831763c796e24d8",
-                "reference": "756173cf6593c3d530fca0e54831763c796e24d8",
+                "url": "https://api.github.com/repos/Laravel-Backpack/CRUD/zipball/239e60df0436f8a817facce20a2dffcb2b6e7250",
+                "reference": "239e60df0436f8a817facce20a2dffcb2b6e7250",
                 "shasum": ""
             },
             "require": {
             ],
             "support": {
                 "issues": "https://github.com/Laravel-Backpack/CRUD/issues",
-                "source": "https://github.com/Laravel-Backpack/CRUD/tree/4.1.51"
+                "source": "https://github.com/Laravel-Backpack/CRUD/tree/4.1.52"
             },
-            "time": "2021-09-02T06:20:26+00:00"
+            "time": "2021-09-06T06:35:01+00:00"
         },
         {
             "name": "backpack/logmanager",
             "source": {
                 "type": "git",
                 "url": "git://git.cubedesigners.com/cubist_util.git",
-                "reference": "4c5cd619a89e6679fca80ff84036f68c554426a7"
+                "reference": "12177cd5bd8abcefa708e3aabdf9985ef3e3b85d"
             },
             "dist": {
                 "type": "tar",
-                "url": "https://composer.cubedesigners.com/dist/cubist/util/cubist-util-dev-master-906685.tar",
-                "reference": "4c5cd619a89e6679fca80ff84036f68c554426a7",
-                "shasum": "b5b3518f6c33d521010f9878c31e05c2abbc9c91"
+                "url": "https://composer.cubedesigners.com/dist/cubist/util/cubist-util-dev-master-610682.tar",
+                "reference": "12177cd5bd8abcefa708e3aabdf9985ef3e3b85d",
+                "shasum": "91ae258076cacde665055cd5c1f7b728b95ea4e2"
             },
             "require": {
                 "cubist/net": "dev-master",
                 }
             ],
             "description": "Utilities class",
-            "time": "2021-04-20T13:58:22+00:00"
+            "time": "2021-09-03T16:57:58+00:00"
         },
         {
             "name": "cviebrock/eloquent-sluggable",
             },
             "time": "2020-10-22T13:48:01+00:00"
         },
+        {
+            "name": "fluidbook/tools",
+            "version": "dev-master",
+            "source": {
+                "type": "git",
+                "url": "git://git.cubedesigners.com/fluidbook_tools.git",
+                "reference": "fbcd179c04e2bd1061307bcabda70a9756b4217b"
+            },
+            "dist": {
+                "type": "tar",
+                "url": "https://composer.cubedesigners.com/dist/fluidbook/tools/fluidbook-tools-dev-master-d6dc02.tar",
+                "reference": "fbcd179c04e2bd1061307bcabda70a9756b4217b",
+                "shasum": "88e7797805be96ed7a2ba0842029d42f1466d5b4"
+            },
+            "require": {
+                "cubist/util": "dev-master",
+                "ext-dom": "*",
+                "ext-gd": "*",
+                "ext-iconv": "*",
+                "ext-json": "*",
+                "ext-libxml": "*",
+                "ext-mbstring": "*",
+                "ext-simplexml": "*",
+                "laravel/framework": "~5.8|^6.0|^7.0|^8.0",
+                "php": ">=7.0.0"
+            },
+            "default-branch": true,
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Fluidbook\\Tools\\": "src"
+                }
+            },
+            "license": [
+                "proprietary"
+            ],
+            "authors": [
+                {
+                    "name": "Vincent Vanwaelscappel",
+                    "email": "vincent@cubedesigners.com"
+                }
+            ],
+            "description": "Fluidbook Tools",
+            "time": "2021-09-06T17:21:56+00:00"
+        },
         {
             "name": "fruitcake/laravel-cors",
             "version": "v2.0.4",
         },
         {
             "name": "nesbot/carbon",
-            "version": "2.52.0",
+            "version": "2.53.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/briannesbitt/Carbon.git",
-                "reference": "369c0e2737c56a0f39c946dd261855255a6fccbe"
+                "reference": "f4655858a784988f880c1b8c7feabbf02dfdf045"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/369c0e2737c56a0f39c946dd261855255a6fccbe",
-                "reference": "369c0e2737c56a0f39c946dd261855255a6fccbe",
+                "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/f4655858a784988f880c1b8c7feabbf02dfdf045",
+                "reference": "f4655858a784988f880c1b8c7feabbf02dfdf045",
                 "shasum": ""
             },
             "require": {
             },
             "require-dev": {
                 "doctrine/orm": "^2.7",
-                "friendsofphp/php-cs-fixer": "^2.14 || ^3.0",
+                "friendsofphp/php-cs-fixer": "^3.0",
                 "kylekatarnls/multi-tester": "^2.0",
                 "phpmd/phpmd": "^2.9",
                 "phpstan/extension-installer": "^1.0",
                     "type": "tidelift"
                 }
             ],
-            "time": "2021-08-14T19:10:52+00:00"
+            "time": "2021-09-06T09:29:23+00:00"
         },
         {
             "name": "nikic/php-parser",
         },
         {
             "name": "fakerphp/faker",
-            "version": "v1.15.0",
+            "version": "v1.16.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/FakerPHP/Faker.git",
-                "reference": "89c6201c74db25fa759ff16e78a4d8f32547770e"
+                "reference": "271d384d216e5e5c468a6b28feedf95d49f83b35"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/89c6201c74db25fa759ff16e78a4d8f32547770e",
-                "reference": "89c6201c74db25fa759ff16e78a4d8f32547770e",
+                "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/271d384d216e5e5c468a6b28feedf95d49f83b35",
+                "reference": "271d384d216e5e5c468a6b28feedf95d49f83b35",
                 "shasum": ""
             },
             "require": {
                 "php": "^7.1 || ^8.0",
-                "psr/container": "^1.0",
+                "psr/container": "^1.0 || ^2.0",
                 "symfony/deprecation-contracts": "^2.2"
             },
             "conflict": {
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-main": "v1.15-dev"
+                    "dev-main": "v1.16-dev"
                 }
             },
             "autoload": {
             ],
             "support": {
                 "issues": "https://github.com/FakerPHP/Faker/issues",
-                "source": "https://github.com/FakerPHP/Faker/tree/v1.15.0"
+                "source": "https://github.com/FakerPHP/Faker/tree/v1.16.0"
             },
-            "time": "2021-07-06T20:39:40+00:00"
+            "time": "2021-09-06T14:53:37+00:00"
         },
         {
             "name": "filp/whoops",
     "aliases": [],
     "minimum-stability": "dev",
     "stability-flags": {
-        "cubist/cms-back": 20
+        "cubist/cms-back": 20,
+        "fluidbook/tools": 20
     },
     "prefer-stable": true,
     "prefer-lowest": false,
     "platform": {
-        "php": "^7.3|^8.0",
+        "php": "^8.0",
         "ext-json": "*",
+        "ext-redis": "*",
         "ext-simplexml": "*",
         "ext-tidy": "*",
         "ext-zip": "*"