Ejemplo n.º 1
0
 /**
  * getThumbnailUrl will fetch the primary thumbnail for a given content. If nothing has been set, it will fetch the last thumbnail it can find.
  *
  * @param string $pSize
  * @param array $pInfoHash
  * @access public
  * @return boolean TRUE on success, FALSE on failure - $this->mErrors will contain reason for failure
  */
 public function getThumbnailUrl($pSize = 'small', $pInfoHash = NULL, $pSecondary = NULL, $pDefault = TRUE)
 {
     $ret = NULL;
     if (!empty($pInfoHash)) {
         // do some stuff if we are given a hash of stuff
     } elseif ($this->isValid() && !empty($this->mStorage)) {
         foreach (array_keys($this->mStorage) as $attachmentId) {
             if (!empty($this->mStorage[$attachmentId]['is_primary'])) {
                 break;
             }
         }
         if (!empty($this->mStorage[$attachmentId]['thumbnail_url'][$pSize])) {
             $ret = $this->mStorage[$attachmentId]['thumbnail_url'][$pSize];
         }
     }
     if ($pDefault && empty($ret)) {
         $ret = parent::getThumbnailUrl($pSize, $pInfoHash, $pSecondary);
     }
     return $ret;
 }