]> _ Git - cubeextranet.git/commitdiff
wip #819 @1.4
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 6 Mar 2018 18:48:27 +0000 (18:48 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 6 Mar 2018 18:48:27 +0000 (18:48 +0000)
fluidbook/compile/favicon.png [new file with mode: 0644]
inc/commons/class.common.tools.php
inc/ws/Util/packager/class.ws.packager.win.exe.html.php

diff --git a/fluidbook/compile/favicon.png b/fluidbook/compile/favicon.png
new file mode 100644 (file)
index 0000000..983708a
Binary files /dev/null and b/fluidbook/compile/favicon.png differ
index 4d89f4c0456f259e48e551d7114721110321a959..6742ac0392753b1df7be6048117e9a6f39a0e887 100644 (file)
@@ -468,8 +468,6 @@ class commonTools {
                        //$conv->debug();
                }
 
-               $png2icns = new cubeCommandLine('png2icns');
-               $png2icns->setArg(null, $tmp . '/favicon.icns');
 
                $icotool = new cubeCommandLine('icotool');
                $icotool->setArg('c');
@@ -478,11 +476,13 @@ class commonTools {
                $icoSizes = array(8, 16, 20, 24, 32, 40, 48, 64, 96, 128, 256, 512);
                $sizes = array(16, 32, 48, 64, 128, 256, 512);
                $apple = array(152, 144, 120, 114, 76, 72, 57);
-               $icns = array(128, 256, 512);
 
-               $sizes = array_merge($icoSizes, $sizes, $apple, $icns);
+
+               $sizes = array_merge($icoSizes, $sizes, $apple);
                rsort($sizes);
 
+               self::pngToIcns($round, $tmp . '/favicon.icns');
+
                foreach ($sizes as $s) {
                        if (in_array($s, $apple)) {
                                $r = $tmp . '/favicon-ios-' . $s . '.png';
@@ -504,9 +504,7 @@ class commonTools {
                        if (in_array($s, $icoSizes)) {
                                $icotool->setArg(null, $r);
                        }
-                       if (in_array($s, $icns)) {
-                               $png2icns->setArg(null, $r);
-                       }
+
 
                }
 
@@ -542,6 +540,33 @@ class commonTools {
                `rm -rf $tmp`;
        }
 
+       public static function pngToIcns($file, $res) {
+               $icns = array(128, 256, 512);
+
+               $png2icns = new cubeCommandLine('png2icns');
+               $png2icns->setArg(null, $res);
+
+               $tmp = array();
+
+               foreach ($icns as $s) {
+                       $r = CubeIT_Files::tempnam() . '.png';
+                       $tmp[]=$r;
+                       $it = new cubeImageTools();
+                       $it->loadImage($file);
+                       $it->resize($s, $s, 'crop', true, 'C', 'M', 'transparent');
+                       $it->output('png', $r);
+                       if (in_array($s, $icns)) {
+                               $png2icns->setArg(null, $r);
+                       }
+               }
+
+               $png2icns->execute();
+
+               foreach ($tmp as $item) {
+                       unlink($tmp);
+               }
+       }
+
        public static function getDefaultLanguage() {
                $available = explode(',', $_GET['available']);
                $accept = null;
index abe424dba0d2540bd018130c4c439db3dc284968..892cf283497f459b788d441c26de25066afb1e96 100644 (file)
@@ -39,6 +39,8 @@ class wsPackagerWinEXEHTML extends wsPackager {
                $cl->setPath(CONVERTER_PATH);\r
                $cl->setArg('p', $this->nwplatform);\r
                $cl->setArg('o', $this->buildPath);\r
+               $cl->setArg('winIco', $this->vdir . '/icon.ico');\r
+               $cl->setArg('macIcns', $this->vdir . '/icon.icns');\r
                $cl->setArg(null, $this->vdir);\r
                $cl->execute();\r
        }\r
@@ -48,6 +50,20 @@ class wsPackagerWinEXEHTML extends wsPackager {
                         'webkit' => [],\r
                         'window' => ['height' => 768, 'width' => 1024, 'title' => $this->appName, 'id' => 'main', 'icon' => 'icon.png', 'mac_icon' => 'icon.icns']\r
                ];\r
+               $pngIcon = $this->vdir . '/icon.png';\r
+               $winIcon = $this->vdir . '/icon.icon';\r
+               if ($this->theme->parametres->favicon == '') {\r
+                       $png = WS_COMPILE_ASSETS . '/fluidbook.png';\r
+                       $ico = WS_COMPILE_ASSETS . '/fluidbook.ico';\r
+               } else {\r
+                       $png = $this->vdir . '/data/favicon.png';\r
+                       $ico = $this->vdir . '/data/favicon.ico';\r
+               }\r
+\r
+               $icns = $this->vdir . '/icon.icns';\r
+               $this->copy($png, $pngIcon);\r
+               $this->copy($ico, $winIcon);\r
+               commonTools::pngToIcns($png, $icns);\r
                file_put_contents($this->vdir . '/package.json', json_encode($data));\r
        }\r
 \r