-
-
Save codemasher/7f526404df2743b968a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @package gwskills | |
* @filesource skill_images.php | |
* @version 0.1.0 | |
* @link https://github.com/codemasher/ | |
* @created 25.03.14 | |
* | |
* @author Smiley <smiley@chillerlan.net> | |
* @copyright Copyright (c) 2014 {@link https://twitter.com/codemasher Smiley} <smiley@chillerlan.net> | |
* @license http://opensource.org/licenses/mit-license.php The MIT License (MIT) | |
*/ | |
set_time_limit(0); | |
mb_internal_encoding('UTF-8'); | |
require_once('../common.php'); | |
// http://www.guildwarsguru.com/forum/king-size-skill-icons-t10295191.html | |
$q = $db->Q('SELECT t1.`id`, LOWER(t1.`name_en`) as `skill`, LOWER(t2.`name_en`) AS `prof`, t1.`elite` FROM `gw1_skills_pve` AS t1, `gw1_professions` AS t2 WHERE t1.`profession` != 0 AND t1.`pve` = 0 AND t2.`id` = t1.`profession` ORDER BY t1.`profession` ASC, t1.`campaign` ASC'); | |
foreach($q as $s){ | |
$s['skill'] = str_replace(['!','\'','"',',','.',' '],['','','','','','_'],$s['skill']); | |
$icon = imagecreatefromjpeg('orig/'.$s['prof'].'/'.$s['skill'].'.jpg'); | |
$new_icon = (bool)$s['elite'] ? imagecreatetruecolor(276, 276) : imagecreatetruecolor(248, 248); | |
if((bool)$s['elite']){ | |
imagefilledrectangle($new_icon, 0, 0, 276, 276, imagecolorallocate($new_icon, hexdec('ff'), hexdec('b5'), hexdec('00'))); | |
imagecopy($new_icon, $icon, 14, 14, 4, 3, 248, 248); | |
} | |
else{ | |
imagecopy($new_icon, $icon, 0, 0, 4, 3, 248, 248); | |
} | |
imagepng($new_icon,'img/'.$s['id'].'.png',9); | |
# echo '<img src="../img/'.$s['prof'].'/'.$s['skill'].'.jpg" title="'.$s['skill'].' - '.$s['id'].'">'; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment