is it 2015 already..?

setup/simpleImg:
 - also prefer PNG over BLP when generating icons
 - do not use alpha on icons (see icon: fishingextravaganza)
This commit is contained in:
Sarjuuk
2015-05-18 23:04:12 +02:00
parent 1d6ecc86d7
commit 3d80041df9
4 changed files with 37 additions and 5 deletions

View File

@@ -113,7 +113,7 @@ function build()
$allOk = false;
CLISetup::log(' - subscript \''.$file.'\' returned '.($ok ? 'sucessfully' : 'with errors'), $ok ? CLISetup::LOG_OK : CLISetup::LOG_ERROR);
set_time_limit(SqlGen::$defaultExecTime); // reset to default for the next script
set_time_limit(FileGen::$defaultExecTime); // reset to default for the next script
}
// end

View File

@@ -82,7 +82,10 @@ if (!CLI)
$file = $path.'.png';
if (CLISetup::fileExists($file))
{
CLISetup::log('manually converted png file present for '.$path.'.', CLISetup::LOG_WARN);
$result = imagecreatefrompng($file);
}
if (!$result)
{

View File

@@ -15,6 +15,32 @@ if (!CLI)
function simpleImg()
{
// prefer manually converted PNG files (as the imagecreatefromblp-script has issues with some formats)
// see: https://github.com/Kanma/BLPConverter
$loadImageFile = function($path)
{
$result = null;
if (in_array(substr($path, -4, 4), ['.png', '.blp']))
$path = substr($path, 0, strlen($path) - 4);
$file = $path.'.png';
if (CLISetup::fileExists($file))
{
CLISetup::log('manually converted png file present for '.$path.'.', CLISetup::LOG_WARN);
$result = imagecreatefrompng($file);
}
if (!$result)
{
$file = $path.'.blp';
if (CLISetup::fileExists($file))
$result = imagecreatefromblp($file);
}
return $result;
};
if (isset(FileGen::$cliOpts['help']))
{
echo "\n";
@@ -131,8 +157,11 @@ if (!CLI)
{
$ok = false;
$dest = imagecreatetruecolor($destDims['w'], $destDims['h']);
imagesavealpha($dest, true);
if ($ext == 'png')
imagealphablending($dest, false);
imagecopyresampled($dest, $src, $destDims['x'], $destDims['x'], $srcDims['x'], $srcDims['y'], $destDims['w'], $destDims['h'], $srcDims['w'], $srcDims['h']);
switch ($ext)
@@ -320,7 +349,7 @@ if (!CLI)
}
if (!$src)
$src = imagecreatefromblp($f);
$src = $loadImageFile($f);
if (!$src) // error should be created by imagecreatefromblp
continue;
@@ -383,7 +412,7 @@ if (!CLI)
}
if (!$src)
$src = imagecreatefromblp($f);
$src = $loadImageFile($f);
if (!$src) // error should be created by imagecreatefromblp
continue;

View File

@@ -56,7 +56,7 @@
<a href="?aboutus"><?php echo Lang::main('aboutUs'); ?></a>|
<a href="#" id="footer-links-language"><?php echo Lang::main('language'); ?></a>
</div>
<div class="footer-copy">&#12484; 2014 Aowow</div>
<div class="footer-copy">&#12484; 2015 Aowow</div>
</div>
<?php $this->brick('pageTemplate'); ?>