//$conv->debug();
}
- $png2icns = new cubeCommandLine('png2icns');
- $png2icns->setArg(null, $tmp . '/favicon.icns');
$icotool = new cubeCommandLine('icotool');
$icotool->setArg('c');
$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';
if (in_array($s, $icoSizes)) {
$icotool->setArg(null, $r);
}
- if (in_array($s, $icns)) {
- $png2icns->setArg(null, $r);
- }
+
}
`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;
$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
'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