示例#1
0
 /**
  * Return the URL for the alliance's portrait. If the alliance has a
  * portrait in the board's img/alliances directory, that portrait will be
  * used
  *
  * @param integer $size The desired portrait size.
  * @return string URL for a portrait.
  */
 function getPortraitURL($size = 128)
 {
     if (isset($this->imgurl[$size])) {
         return $this->imgurl[$size];
     }
     if (file_exists("img/alliances/" . $this->getUnique() . ".png")) {
         if ($size == 128) {
             $this->imgurl[$size] = IMG_HOST . "/img/alliances/" . $this->getUnique() . ".png";
         } else {
             if (CacheHandler::exists($this->getUnique() . "_{$size}.png", 'img')) {
                 $this->imgurl[$size] = KB_HOST . "/" . CacheHandler::getExternal($this->getUnique() . "_{$size}.png", 'img');
             } else {
                 $this->imgurl[$size] = KB_HOST . '/?a=thumb&type=alliance&id=' . $this->getUnique() . '&size=' . $size;
             }
         }
         $this->putCache();
     } else {
         if ($this->getExternalID()) {
             $this->imgurl[$size] = imageURL::getURL('Alliance', $this->getExternalID(), $size);
             $this->putCache();
         } else {
             $this->imgurl[$size] = imageURL::getURL('Alliance', 1, $size);
         }
     }
     return $this->imgurl[$size];
 }