/**
  * @static
  * @param Title $fileTitle
  * @param array $config ( contextWidth, contextHeight, imageMaxWidth, userAvatarWidth )
  * TODO - this method is very specific to lightbox.  This needs to be refactored back out to lightbox, and return just the basic objects (file, user, tect)
  * @return array
  */
 public static function getMediaDetail($fileTitle, $config = array())
 {
     $data = array('mediaType' => '', 'videoEmbedCode' => '', 'playerAsset' => '', 'imageUrl' => '', 'fileUrl' => '', 'rawImageUrl' => '', 'description' => '', 'userThumbUrl' => '', 'userId' => '', 'userName' => '', 'userPageUrl' => '', 'articles' => array(), 'providerName' => '', 'videoViews' => 0, 'exists' => false, 'isAdded' => true, 'extraHeight' => 0);
     if (!empty($fileTitle)) {
         if ($fileTitle->getNamespace() != NS_FILE) {
             $fileTitle = Title::newFromText($fileTitle->getDBKey(), NS_FILE);
         }
         $file = self::getFileFromTitle($fileTitle, true);
         if (!empty($file)) {
             $config = self::getMediaDetailConfig($config);
             $data['exists'] = true;
             $data['mediaType'] = self::isFileTypeVideo($file) ? 'video' : 'image';
             $width = (int) $file->getWidth();
             $height = (int) $file->getHeight();
             if ($data['mediaType'] == 'video') {
                 $width = $config['contextWidth'] ? $config['contextWidth'] : $width;
                 $height = $config['contextHeight'] ? $config['contextHeight'] : $height;
                 if (isset($config['maxHeight'])) {
                     $file->setEmbedCodeMaxHeight($config['maxHeight']);
                 }
                 $options = ['autoplay' => true, 'isAjax' => true, 'isInline' => !empty($config['isInline'])];
                 $data['videoEmbedCode'] = $file->getEmbedCode($width, $options);
                 $data['playerAsset'] = $file->getPlayerAssetUrl();
                 $data['videoViews'] = MediaQueryService::getTotalVideoViewsByTitle($fileTitle->getDBKey());
                 $data['providerName'] = $file->getProviderName();
                 $data['duration'] = $file->getMetadataDuration();
                 $data['isAdded'] = self::isAdded($file);
                 $mediaPage = self::getMediaPage($fileTitle);
                 // Extra height is needed for lightbox when more elements must be fitted
                 if (strtolower($data['providerName']) == 'crunchyroll') {
                     $data['extraHeight'] = CrunchyrollVideoHandler::CRUNCHYROLL_WIDGET_HEIGHT_PX;
                 }
             } else {
                 $width = !empty($config['imageMaxWidth']) ? min($config['imageMaxWidth'], $width) : $width;
                 $mediaPage = new ImagePage($fileTitle);
             }
             $thumb = $file->transform(array('width' => $width, 'height' => $height), 0);
             $user = User::newFromId($file->getUser('id'));
             // get article list
             $mediaQuery = new ArticlesUsingMediaQuery($fileTitle);
             $articleList = $mediaQuery->getArticleList();
             if ($data['isAdded']) {
                 $data['fileUrl'] = $fileTitle->getFullUrl();
             } else {
                 $data['fileUrl'] = self::getFullUrlPremiumVideo($fileTitle->getDBkey());
             }
             $data['imageUrl'] = $thumb->getUrl();
             $data['rawImageUrl'] = $file->getUrl();
             $data['userId'] = $user->getId();
             $data['userName'] = $user->getName();
             $data['userThumbUrl'] = AvatarService::getAvatarUrl($user, $config['userAvatarWidth']);
             $data['userPageUrl'] = $user->getUserPage()->getFullURL();
             $data['description'] = $mediaPage->getContent();
             $data['articles'] = $articleList;
             $data['width'] = $width;
             $data['height'] = $height;
         }
     }
     return $data;
 }