Example #1
0
 public static function getIcon($typeID, $size = 64, $mod = false)
 {
     EveIcon::getInstance();
     $iconID = self::$container[$typeID];
     $things = split('_', $iconID);
     //var_dump($typeID);
     //var_dump($things[0].'_64_'.$things[1]);
     $t2 = imagecreatefrompng(EveIcon::ICONS_DIR . EveIcon::T2_META . '.png');
     $navy = imagecreatefrompng(EveIcon::ICONS_DIR . EveIcon::NAVY_META . '.png');
     $base = imagecreatefrompng(EveIcon::ICONS_DIR . $things[0] . '_64_' . $things[1] . '.png');
     imagesavealpha($base, true);
     //imagecopyresampled($base, $navy, 0, 0, 0, 0, 16, 16, 16, 16);
     return imagepng($base);
 }
Example #2
0
 public static function grabImage($typeID, $size = 64)
 {
     EveIcon::getInstance();
     $saveto = 'icons/';
     $ch = curl_init('http://image.eveonline.com/Type/' . $typeID . '_' . $size . '.png');
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
     $raw = curl_exec($ch);
     curl_close($ch);
     $md5 = md5($raw);
     $file = $saveto . $md5 . '.png';
     if (file_exists($file)) {
         unlink($file);
     }
     self::$container[$typeID] = array('file' => $file, 'cache' => time() + 60 * 60 * 24 * 30);
     $jsonFile = fopen('static/type2icon.json', 'w');
     fwrite($jsonFile, json_encode(self::$container));
     fclose($jsonFile);
     $imageFile = fopen($file, 'x');
     fwrite($imageFile, $raw);
     fclose($imageFile);
     return $file;
 }