PHP Web interface for generating QR codes https://qr.antopie.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

36 lines
986 B

<?php
/*
A small script that can be used to generate LibreQR's icons
*/
if (php_sapi_name() == "cli") {
if (isset($argv[1])) {
$done = array();
$line = "";
$theme = $argv[1];
for ($pow = 0; $pow <= 3; $pow++) {
for ($mult = 1; $mult <= 4; $mult++) {
$size = $mult * 2**(4+$pow);
if (!in_array($size, $done)) {
shell_exec("convert themes/" . $theme . "/icons/source.png -scale " . $size . "x" . $size . " themes/" . $theme . "/icons/" . $size . ".png");
shell_exec("pngquant -f themes/" . $theme . "/icons/" . $size . ".png --output themes/" . $theme . "/icons/" . $size . ".png");
$done[] = $size;
}
}
}
foreach ($done as $done) {
$line = $line . ", " . $done;
}
echo substr($line, 2) . "\n";
} else {
echo "Usage: php themes/resize.php <theme name>\n";
}
} else {
echo "Available only via CLI for security reasons. Use 'php themes/resize.php <theme name>'";
}