Exemplo n.º 1
0
 /**
  * Work out the URL to the image for this article
  * @param $pTopicId id of the article we need the image path for
  * @param $pBasePathOnly bool TRUE / FALSE - specify whether you want full path or just base path
  * @return URL on success, FALSE on failure
  * @access public
  **/
 public function getTopicImageStorageUrl($pTopicId = NULL, $pBasePathOnly = FALSE, $pForceRefresh = FALSE)
 {
     global $gBitSystem;
     $ret = FALSE;
     // first we check to see if this is a new type thumbnail. if that fails we'll use the old method
     if (!($ret = BitArticleTopic::getTopicImageThumbUrl($pTopicId))) {
         $url = BitArticleTopic::getArticleImageStorageUrl(NULL, TRUE);
         if ($pBasePathOnly) {
             return $url;
         }
         if (!@BitBase::verifyId($pTopicId)) {
             if ($this->isValid()) {
                 $pTopicId = $this->mTopicId;
             } else {
                 return NULL;
             }
         }
         if (is_file(BitArticleTopic::getTopicImageStoragePath(NULL, TRUE) . BitArticleTopic::getTopicImageStorageName($pTopicId))) {
             $ret = $url . BitArticleTopic::getTopicImageStorageName($pTopicId) . ($pForceRefresh ? "?" . $gBitSystem->getUTCTime() : '');
         }
     }
     return str_replace("//", "/", $ret);
 }