]> _ Git - fluidbook_tools.git/commitdiff
wait #6530
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 28 Nov 2023 14:01:22 +0000 (15:01 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 28 Nov 2023 14:01:22 +0000 (15:01 +0100)
.idea/fluidbook_tools.iml
.idea/php.xml
src/Links/LayerLink.php
src/Links/ZoomLink.php
src/SVG/SVGTools.php

index ecd464b66a369423420b4752c1021b4bb18a20d2..2fc5484794c13f130e763c9bec601c4d74ecfd5f 100644 (file)
@@ -6,6 +6,7 @@
     <exclude-output />
     <content url="file://$MODULE_DIR$">
       <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" packagePrefix="Fluidbook\Tools\" />
+      <sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
       <excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
       <excludeFolder url="file://$MODULE_DIR$/vendor/brick/math" />
       <excludeFolder url="file://$MODULE_DIR$/vendor/nette/schema" />
       <excludeFolder url="file://$MODULE_DIR$/vendor/symfony/uid" />
       <excludeFolder url="file://$MODULE_DIR$/vendor/chillerlan/php-qrcode" />
       <excludeFolder url="file://$MODULE_DIR$/vendor/chillerlan/php-settings-container" />
+      <excludeFolder url="file://$MODULE_DIR$/vendor/carbonphp/carbon-doctrine-types" />
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
index c271f25d2affbb26dbd007817bc603490d54c785..ac96ba9d6668b54fc9d20ea0efae01273188e567 100644 (file)
       <path value="$PROJECT_DIR$/vendor/psr/clock" />
       <path value="$PROJECT_DIR$/vendor/chillerlan/php-settings-container" />
       <path value="$PROJECT_DIR$/vendor/chillerlan/php-qrcode" />
+      <path value="$PROJECT_DIR$/vendor/carbonphp/carbon-doctrine-types" />
     </include_path>
   </component>
   <component name="PhpProjectSharedConfiguration" php_language_level="8.0">
index 270229f7e08117cd03feff90ed17d6ac9ab9dea7..ac65a8e147372fb4da5891813a04a39a2e50f240 100644 (file)
@@ -28,6 +28,7 @@ class LayerLink extends ImageLink
     public function getCSS()
     {
         $attributes = $this->getZoomAttributes();
+
         if (!$this->rightClone) {
             ZoomLink::generateImage($attributes, $this->compiler, 'layerlink', 'layer');
         }
index aefa38f49e1eaf395e56adb5b3a73e621c0ef122..267d4c0202a6194a7c53891f2b5ec9600554cb1b 100644 (file)
@@ -4,6 +4,7 @@ namespace Fluidbook\Tools\Links;
 
 use Cubist\Util\CommandLine\Imagemagick;
 use Cubist\Util\CommandLine\Poppler;
+use Cubist\Util\Files\Files;
 use Cubist\Util\Graphics\PDF;
 use Cubist\Util\Text;
 use Fluidbook\Tools\Compiler\CompilerInterface;
@@ -160,6 +161,7 @@ class ZoomLink extends NormalLink {
         $cache = $compiler->getCacheDir("zoomarea/" . $cachedir);
 
 
+
         $leftHeight = min($h, $compiler->getHeightForLinks($attributes['page']) - $y);
         $leftWidth = min($w, $compiler->getWidthForLinks($attributes['page']) - $x);
 
@@ -169,7 +171,8 @@ class ZoomLink extends NormalLink {
             $extractPage,
             $leftArea,
             null, $extractOptions, $cache);
-        if (!file_exists($leftfile)) {
+
+        if (Files::isEmpty($leftfile)) {
             throw new \Exception('Failed to generate image with ' . json_encode($attributes));
         }
 
@@ -188,19 +191,19 @@ class ZoomLink extends NormalLink {
                 ['x' => 0, 'y' => $y, 'width' => $diff, 'height' => $h],
                 null, $extractOptions, $cache);
 
-            if (!file_exists($rightfile)) {
+            if (Files::isEmpty($rightfile)) {
                 throw new \Exception('Error generating right part ' . $rightfile);
             }
 
             $both = $cache . hash('sha256', $leftfile . $rightfile) . '.' . $ext;
-            if (!file_exists($both)) {
+            if (Files::isEmpty($both)) {
                 if ($ext === 'svg') {
                     SVGTools::append($leftfile, $rightfile, $both, 'h');
                 } else {
                     Imagemagick::append(array($leftfile, $rightfile), $both, 'horizontal');
                 }
             }
-            if (!file_exists($both)) {
+            if (Files::isEmpty($both)) {
                 throw new \Exception('Error glueing ' . $leftfile . ' and ' . $rightfile);
             }
         } else {
@@ -209,7 +212,7 @@ class ZoomLink extends NormalLink {
 
         if ($trim) {
             $trimmed = str_replace('.jpg', '.trim.' . $ext, $both);
-            if (!file_exists($trimmed) || filemtime($trimmed) < filemtime($both)) {
+            if (Files::isEmpty($trimmed) || filemtime($trimmed) < filemtime($both)) {
                 Imagemagick::trim($both, $trimmed);
             }
             $both = $trimmed;
@@ -224,7 +227,7 @@ class ZoomLink extends NormalLink {
         //                dd($both);
 
 
-        if (!file_exists($both)) {
+        if (Files::isEmpty($both)) {
             Log::error('Failed generate image ' . json_encode($attributes));
         }
         $dest = 'data/links/' . $save . '_' . $attributes['id'] . '.' . $ext;
index 6dce37933bb04d135cc3d05458650820926aec28..9d44ee90fee51262f51890258955fc693d28ceb6 100644 (file)
@@ -178,9 +178,9 @@ class SVGTools
         $cli->setArg('d', $dest);
         $cli->execute();
         if (!stristr($cli->getOutput(), 'done')) {
-
             $cli->dd();
         }
+
     }
 
     public static function append($first, $second, $dest, $direction = 'h')