From b3b2f3699d44a71845845cb7e41421483c1f478c Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Thu, 21 Feb 2019 11:20:23 +0000 Subject: [PATCH] fix #2603 @0.5 --- .../html5/master/class.ws.html5.compiler.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/inc/ws/Util/html5/master/class.ws.html5.compiler.php b/inc/ws/Util/html5/master/class.ws.html5.compiler.php index 0f8a83c2c..528207d85 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -826,8 +826,25 @@ class wsHTML5Compiler if ($this->theme->parametres->favicon != '') { $pngFile = $this->themeRoot . '/' . $this->theme->parametres->favicon; + $icoFile = $this->themeRoot . '/favicon.ico'; + if (!file_exists($icoFile) || filemtime($icoFile) < filemtime($pngFile) || filemtime(__FILE__) > filemtime($icoFile)) { + $tmp = CubeIT_Files::tempnam() . '.png'; + $convert = "convert $pngFile -resize 64x64^ -gravity center $tmp"; + `$convert`; + + $icotool = new cubeCommandLine('icotool'); + $icotool->setArg('c'); + $icotool->setArg('o', $icoFile); + $icotool->setArg(null, $tmp); + $icotool->execute(); + + unlink($tmp); + } + + $this->vdir->copy($icoFile, 'data/favicon.ico'); $this->vdir->copy($pngFile, 'data/favicon.png'); + $datapng = 'data:image/png;base64,' . base64_encode(file_get_contents($pngFile)); $favicon .= '' . "\n\t"; -- 2.39.5