]> _ Git - cubeextranet.git/commitdiff
fix #2603 @0.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 21 Feb 2019 11:20:23 +0000 (11:20 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 21 Feb 2019 11:20:23 +0000 (11:20 +0000)
inc/ws/Util/html5/master/class.ws.html5.compiler.php

index 0f8a83c2c3a1cf08faad1b8304d5b0fb45dcc270..528207d855f1928cb1156992d37469753f8786ac 100644 (file)
@@ -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 .= '<link rel="icon" type="image/png" href="' . $datapng . '" />' . "\n\t";