From: vincent@cubedesigners.com Date: Tue, 6 Mar 2018 18:48:27 +0000 (+0000) Subject: wip #819 @1.4 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=424281f95733d97e55d38eda8ff961ba1532c889;p=cubeextranet.git wip #819 @1.4 --- diff --git a/fluidbook/compile/favicon.png b/fluidbook/compile/favicon.png new file mode 100644 index 000000000..983708ade Binary files /dev/null and b/fluidbook/compile/favicon.png differ diff --git a/inc/commons/class.common.tools.php b/inc/commons/class.common.tools.php index 4d89f4c04..6742ac039 100644 --- a/inc/commons/class.common.tools.php +++ b/inc/commons/class.common.tools.php @@ -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; diff --git a/inc/ws/Util/packager/class.ws.packager.win.exe.html.php b/inc/ws/Util/packager/class.ws.packager.win.exe.html.php index abe424dba..892cf2834 100644 --- a/inc/ws/Util/packager/class.ws.packager.win.exe.html.php +++ b/inc/ws/Util/packager/class.ws.packager.win.exe.html.php @@ -39,6 +39,8 @@ class wsPackagerWinEXEHTML extends wsPackager { $cl->setPath(CONVERTER_PATH); $cl->setArg('p', $this->nwplatform); $cl->setArg('o', $this->buildPath); + $cl->setArg('winIco', $this->vdir . '/icon.ico'); + $cl->setArg('macIcns', $this->vdir . '/icon.icns'); $cl->setArg(null, $this->vdir); $cl->execute(); } @@ -48,6 +50,20 @@ class wsPackagerWinEXEHTML extends wsPackager { 'webkit' => [], 'window' => ['height' => 768, 'width' => 1024, 'title' => $this->appName, 'id' => 'main', 'icon' => 'icon.png', 'mac_icon' => 'icon.icns'] ]; + $pngIcon = $this->vdir . '/icon.png'; + $winIcon = $this->vdir . '/icon.icon'; + if ($this->theme->parametres->favicon == '') { + $png = WS_COMPILE_ASSETS . '/fluidbook.png'; + $ico = WS_COMPILE_ASSETS . '/fluidbook.ico'; + } else { + $png = $this->vdir . '/data/favicon.png'; + $ico = $this->vdir . '/data/favicon.ico'; + } + + $icns = $this->vdir . '/icon.icns'; + $this->copy($png, $pngIcon); + $this->copy($ico, $winIcon); + commonTools::pngToIcns($png, $icns); file_put_contents($this->vdir . '/package.json', json_encode($data)); }