コード例 #1
0
 public static function onLinkerMakeThumbLink2FileOriginalSize($file, &$width)
 {
     if (WikiaFileHelper::isVideoFile($file)) {
         $width = WikiaFileHelper::maxWideoWidth;
     }
     return true;
 }
コード例 #2
0
 public function getVideoData($titleText, $thumbnailWidth, $videoWidth = self::DEFAULT_OASIS_VIDEO_WIDTH, $autoplay = true, $useMaster = false, $cityShort = 'life', $videoHeight = '', $useJWPlayer = true, $inAjaxResponse = false)
 {
     wfProfileIn(__METHOD__);
     $data = array();
     $title = Title::newFromText($titleText, NS_FILE);
     $file = wfFindFile($title);
     if (!WikiaFileHelper::isVideoFile($file)) {
         $data['error'] = wfMsg('related-videos-error-no-video-title');
     } else {
         $meta = unserialize($file->getMetadata());
         $trans = $file->transform(array('width' => $thumbnailWidth, 'height' => -1));
         $thumb = array('width' => $trans->width, 'height' => $trans->height, 'thumb' => $trans->url);
         $data['external'] = 0;
         // false means it is not set. Meaningful values: 0 and 1.
         $data['id'] = $titleText;
         $data['fullUrl'] = $title->getFullURL();
         $data['prefixedUrl'] = $title->getPrefixedURL();
         $data['description'] = $file->getDescription();
         $data['duration'] = $meta['duration'];
         $data['embedCode'] = null;
         $data['embedJSON'] = null;
         $data['provider'] = $file->minor_mime;
         $data['thumbnailData'] = $thumb;
         $data['title'] = $file->getTitle()->getText();
         $data['timestamp'] = $file->getTimestamp();
         $data['uniqueId'] = $file->getVideoUniqueId();
     }
     $data['owner'] = '';
     $data['ownerUrl'] = '';
     wfProfileOut(__METHOD__);
     return $data;
 }
コード例 #3
0
 protected static function invalidateCacheWikiTotalImages($file, $reupload)
 {
     $title = $file->getTitle();
     if ($title instanceof Title && !WikiaFileHelper::isVideoFile($file) && !$reupload) {
         $wikiService = new WikiService();
         $wikiService->invalidateCacheTotalImages();
     }
 }
コード例 #4
0
ファイル: WikiaFilePage.php プロジェクト: Tjorriemorrie/app
 /**
  * Test for whether the current file page represents a video
  * @return bool - true if the file is a video, false if not
  */
 protected function isVideo()
 {
     $file = $this->getDisplayedFile();
     return WikiaFileHelper::isVideoFile($file);
 }
コード例 #5
0
 /**
  * Article figure tags with thumbnails inside. All videos and block images use this.
  */
 public function articleBlock()
 {
     wfProfileIn(__METHOD__);
     $file = $this->getVal('file');
     $width = $this->getVal('outerWidth');
     $url = $this->getVal('url');
     $align = $this->getVal('align');
     $thumbnail = $this->getVal('html');
     $caption = $this->getVal('caption');
     // align classes are prefixed by "t"
     $alignClass = "t" . $align;
     // only show titles for videos
     $title = '';
     $filePageLink = false;
     if ($file instanceof File) {
         $isVideo = WikiaFileHelper::isVideoFile($file);
         if ($isVideo) {
             $title = $file->getTitle()->getText();
         }
         $filePageLink = $file->getTitle()->getLocalURL();
     }
     $this->response->setData(['thumbnail' => $thumbnail, 'title' => $title, 'figureClass' => $alignClass, 'url' => $url, 'caption' => $caption, 'width' => $width, 'showInfoIcon' => !empty($filePageLink) && $width >= self::MIN_INFO_ICON_WIDTH, 'filePageLink' => $filePageLink]);
     wfProfileOut(__METHOD__);
 }
コード例 #6
0
 public static function onThumbnailImageHTML($options, $linkAttribs, $imageAttribs, File $file, &$html)
 {
     global $wgRTEParserEnabled;
     if (!empty($wgRTEParserEnabled)) {
         return true;
     }
     // video thumbnails use a template now.
     if (WikiaFileHelper::isVideoFile($file)) {
         return true;
     }
     wfProfileIn(__METHOD__);
     if (is_null(self::$isWikiaMobile)) {
         self::init();
     }
     if (empty($options['custom-url-link']) && empty($options['custom-title-link']) && !empty($options['desc-link']) && self::$isOasis || self::$isWikiaMobile) {
         $fullImageUrl = false;
         $link = null;
         if (is_array($linkAttribs)) {
             if (!empty($file)) {
                 // $fullImageUrl only used on mobile
                 $fullImageUrl = wfReplaceImageServer($file->getUrl(), $file->getTimestamp());
             }
             if (!empty($options['custom-url-link'])) {
                 // $link only used on mobile
                 $link = $options['custom-url-link'];
             } elseif (!empty($options['custom-title-link']) && $options['custom-title-link'] instanceof Title) {
                 // Caption is set but image is not a "thumb" so the caption gets set as the title attribute
                 $title = $options['custom-title-link'];
                 $linkAttribs['title'] = $title->getFullText();
                 $link = $title->getLinkUrl();
             } elseif (!empty($options['file-link']) && empty($options['desc-link'])) {
                 $linkAttribs['class'] = empty($linkAttribs['class']) ? ' lightbox' : $linkAttribs['class'] . ' lightbox';
             }
             //override any previous value if title is passed as an option
             if (!empty($options['title'])) {
                 $linkAttribs['title'] = $options['title'];
             }
         }
         //remove the empty alt attribute which we print pretty everywhere (meh)
         if (empty($imageAttribs['alt'])) {
             unset($imageAttribs['alt']);
         }
         $contents = Xml::element('img', $imageAttribs);
         if (self::$isWikiaMobile) {
             $imageParams = array();
             if (!empty($link)) {
                 $linkAttribs['href'] = $link;
             }
             if (empty($linkAttribs['class'])) {
                 $linkAttribs['class'] = 'image';
             }
             if (!empty($imageAttribs['data-image-key'])) {
                 $imageParams['name'] = htmlspecialchars($imageAttribs['data-image-key']);
             }
             if (!empty($fullImageUrl)) {
                 $imageParams['full'] = $fullImageUrl;
             } else {
                 $imageParams['full'] = $imageAttribs['src'];
             }
             if (!empty($options['caption'])) {
                 $imageParams['capt'] = 1;
             }
             //images set to be less than 64px are probably
             //being used as icons in templates
             //do not resize them
             if ((!empty($imageAttribs['width']) && $imageAttribs['width'] > 64 || empty($imageAttribs['width'])) && $file instanceof File) {
                 // TODO: this resizes every image with a width over 64px regardless of where it appears.
                 // We may want to add the ability to allow custom image widths (like on the file page history table for example)
                 $size = WikiaMobileMediaService::calculateMediaSize($file->getWidth(), $file->getHeight());
                 $thumb = $file->transform($size);
                 $imageAttribs['src'] = wfReplaceImageServer($thumb->getUrl(), $file->getTimestamp());
                 $imageAttribs['width'] = $size['width'];
                 $imageAttribs['height'] = $size['height'];
             }
             /**
              *WikiaMobile: lazy loading images in a SEO-friendly manner
              *@author Federico "Lox" Lucignano <federico@wikia-inc.com
              */
             $html = F::app()->sendRequest('WikiaMobileMediaService', 'renderImageTag', ['attributes' => $imageAttribs, 'parameters' => [$imageParams], 'anchorAttributes' => $linkAttribs, 'linked' => !empty($link), 'noscript' => $contents, 'isSmall' => WikiaMobileMediaService::isSmallImage($imageAttribs['width'], $imageAttribs['height'])], true)->toString();
         } else {
             $html = $linkAttribs ? Xml::tags('a', $linkAttribs, $contents) : $contents;
         }
     }
     wfProfileOut(__METHOD__);
     return true;
 }
コード例 #7
0
 /**
  * Load quizElement data (try to use cache layer)
  */
 private function load($master = false)
 {
     global $wgMemc, $wgLang;
     wfProfileIn(__METHOD__);
     if (!$master) {
         $this->mData = $wgMemc->get($this->mMemcacheKey);
     }
     if (empty($this->mData)) {
         $article = Article::newFromID($this->mQuizElementId);
         // check quizElement existance
         if (empty($article)) {
             wfDebug(__METHOD__ . ": quizElement doesn't exist\n");
             wfProfileOut(__METHOD__);
             return;
         }
         // get quizElement's author and creation timestamp
         $title = $article->getTitle();
         $url = $title->getLocalUrl();
         $firstRev = $title->getFirstRevision();
         $titleText = $title->getText();
         $imageSrc = '';
         $imageShort = '';
         $explanation = '';
         $requireEmail = false;
         $videoName = '';
         $videoEmbedCode = '';
         $isVideoExternal = false;
         $quizName = '';
         //@todo support multiple quizzes
         $order = '';
         // parse wikitext with possible answers (stored as wikitext list)
         $content = $article->getContent();
         $lines = explode("\n", $content);
         $answers = array();
         foreach ($lines as $line) {
             $line = trim($line);
             // override article title
             if (substr($line, 0, strlen(self::TITLE_MARKER)) == self::TITLE_MARKER) {
                 $customTitle = trim(substr($line, strlen(self::TITLE_MARKER)));
                 if ($customTitle) {
                     $titleText = $customTitle;
                 }
             } elseif (substr($line, 0, strlen(self::IMAGE_MARKER)) == self::IMAGE_MARKER) {
                 $imageShort = trim(substr($line, strlen(self::IMAGE_MARKER)));
                 $imageSrc = $this->getImageSrc($imageShort);
             } elseif (substr($line, 0, strlen(self::EXPLANATION_MARKER)) == self::EXPLANATION_MARKER) {
                 $explanation = trim(substr($line, strlen(self::EXPLANATION_MARKER)));
             } elseif (startsWith($line, self::VIDEO_MARKER)) {
                 $videoName = trim(substr($line, strlen(self::VIDEO_MARKER)));
             } elseif (startsWith($line, self::VIDEOWIKI_MARKER)) {
                 $videoName = trim(substr($line, strlen(self::VIDEOWIKI_MARKER)));
                 $isVideoExternal = true;
             } elseif (preg_match("/\\[\\[{$wgLang->getNsText(NS_CATEGORY)}\\:(.+?)(\\|(.+))*\\]\\]/", $line, $matches)) {
                 if (startsWith($matches[1], WikiaQuiz::QUIZ_CATEGORY_PREFIX)) {
                     $quizName = trim(substr($matches[1], strlen(WikiaQuiz::QUIZ_CATEGORY_PREFIX)));
                     if (isset($matches[3])) {
                         $order = $matches[3];
                     }
                 }
             } elseif (substr($line, 0, strlen(self::ANSWER_MARKER)) == self::ANSWER_MARKER) {
                 $line = substr($line, strlen(self::ANSWER_MARKER));
                 // correct answer has another marker
                 $correct = FALSE;
                 if (substr($line, 0, strlen(self::CORRECT_ANSWER_MARKER)) == self::CORRECT_ANSWER_MARKER) {
                     $correct = TRUE;
                     $line = trim(substr($line, strlen(self::CORRECT_ANSWER_MARKER)));
                 }
                 if ($line != '') {
                     $answerChunks = explode(self::ANSWER_IMAGE_MARKER, $line);
                     $answers[] = array('text' => $answerChunks[0], 'correct' => $correct, 'image' => isset($answerChunks[1]) ? $this->getImageSrc($answerChunks[1]) : '', 'imageShort' => isset($answerChunks[1]) ? $answerChunks[1] : '');
                 }
             } elseif (substr($line, 0, strlen(self::REQUIRE_EMAIL_MARKER)) == self::REQUIRE_EMAIL_MARKER) {
                 $line = substr($line, strlen(self::REQUIRE_EMAIL_MARKER));
                 $requireEmail = $line == 'true';
             }
         }
         // TODO: handle quizElement parameters (image / video for quizElement)
         $params = array();
         $this->mQuizTitleObject = Title::newFromText($quizName, NS_WIKIA_QUIZ);
         if (!empty($videoName)) {
             $file = wfFindFile($videoName);
             if (WikiaFileHelper::isVideoFile($file)) {
                 $videoEmbedCode = $file->getEmbedCode(self::VIDEO_WIDTH);
             }
         }
         $this->mData = array('creator' => $firstRev->getUser(), 'created' => $firstRev->getTimestamp(), 'touched' => $article->getTouched(), 'url' => $url, 'title' => $titleText, 'question' => $titleText, 'answers' => $answers, 'image' => $imageSrc, 'imageShort' => $imageShort, 'explanation' => $explanation, 'requireEmail' => $requireEmail, 'videoName' => $videoName, 'videoEmbedCode' => $videoEmbedCode, 'quiz' => $quizName, 'quizUrl' => $this->mQuizTitleObject ? $this->mQuizTitleObject->getLocalUrl() : '', 'order' => $order, 'params' => $params);
         wfDebug(__METHOD__ . ": loaded from scratch\n");
         // store it in memcache
         $wgMemc->set($this->mMemcacheKey, $this->mData, self::CACHE_TTL);
     } else {
         wfDebug(__METHOD__ . ": loaded from memcache\n");
     }
     $this->mExists = true;
     wfProfileOut(__METHOD__);
     return;
 }
コード例 #8
0
 /**
  * getUrl - generate url for cut images
  *
  * @access public
  *
  * @param $name \string dbkey of image or File object
  * @param $width \int
  * @param $height \int
  *
  * @return  \string url for image
  */
 public function getUrl($name, $width = 1, $height = 1)
 {
     wfProfileIn(__METHOD__);
     if ($name instanceof File) {
         $img = $name;
     } else {
         //TODO: Create files local cache of IS
         $file_title = Title::newFromText($name, NS_FILE);
         $img = wfFindFile($file_title);
         if (empty($img)) {
             wfProfileOut(__METHOD__);
             return "";
         }
     }
     $issvg = false;
     $mime = strtolower($img->getMimeType());
     if ($mime == 'image/svg+xml' || $mime == 'image/svg') {
         $issvg = true;
     }
     $sPrefix = '';
     if (WikiaFileHelper::isVideoFile($img)) {
         // videos has different thumbnail markup
         $sPrefix = 'v,000000,';
         // they need to be literally centered
         $H = (double) ($width * ($this->proportion['h'] / $this->proportion['w']));
         $this->tmpDeltaY = 0.5 - $H / $height / 2;
     }
     $url = wfReplaceImageServer($img->getThumbUrl($sPrefix . $this->getCut($width, $height) . "-" . $img->getName() . ($issvg ? ".png" : "")));
     wfProfileOut(__METHOD__);
     return $url;
 }
コード例 #9
0
 /**
  * Determines if a page id is a video file
  * @param int $pageId
  * @return boolean
  */
 public function pageIdIsVideoFile($pageId)
 {
     return \WikiaFileHelper::isVideoFile($this->getFileForPageId($pageId));
 }
コード例 #10
0
 protected function isVideo($file)
 {
     return WikiaFileHelper::isVideoFile($file);
 }
コード例 #11
0
 /**
  * @param File $img
  * @param $width
  * @param $height
  * @return String
  */
 private function getLegacyUrl($img, $width, $height)
 {
     $issvg = false;
     $mime = strtolower($img->getMimeType());
     if ($mime == 'image/svg+xml' || $mime == 'image/svg') {
         $issvg = true;
     }
     $sPrefix = '';
     if (WikiaFileHelper::isVideoFile($img)) {
         // videos has different thumbnail markup
         $sPrefix = 'v,000000,';
     }
     $url = wfReplaceImageServer($img->getThumbUrl($sPrefix . $this->getCut($width, $height) . "-" . $img->getName() . ($issvg ? ".png" : "")));
     wfProfileOut(__METHOD__);
     return $url;
 }
コード例 #12
0
 /**
  * This method does the brunt of the work for populating an array with the values
  * we need when servicing the backend search indexer processes
  * @see WikiaSearchIndexer::getPages()
  * @see WikiaSearchController::getPage()
  * @param int $pageId
  * @throws WikiaException
  * @return array result
  */
 public function getPage($pageId)
 {
     wfProfileIn(__METHOD__);
     $result = array();
     $page = F::build('Article', array($pageId), 'newFromID');
     if (!$page instanceof Article) {
         throw new WikiaException('Invalid Article ID');
     }
     if (!$this->parserHookActive) {
         $this->app->registerHook('ParserClearState', 'WikiaSearchIndexer', 'onParserClearState');
         $this->parserHookActive = true;
     }
     // hack: setting wgTitle as rendering fails otherwise
     $wgTitle = $this->wg->Title;
     $this->wg->Title = $page->getTitle();
     // hack: setting action=render to exclude "Related Pages" and other unwanted stuff
     $wgRequest = $this->wg->Request;
     $this->wg->Request->setVal('action', 'render');
     if ($page->isRedirect()) {
         $redirectPage = F::build('Article', array($page->getRedirectTarget()));
         $redirectPage->loadContent();
         // hack: setting wgTitle as rendering fails otherwise
         $this->wg->Title = $page->getRedirectTarget();
         $redirectPage->render();
         $canonical = $page->getRedirectTarget()->getPrefixedText();
     } else {
         $page->render();
         $canonical = '';
     }
     $html = $this->wg->Out->getHTML();
     $namespace = $this->wg->Title->getNamespace();
     $isVideo = false;
     $isImage = false;
     if ($namespace == NS_FILE && ($file = $this->wf->findFile($this->wg->Title->getText()))) {
         $detail = WikiaFileHelper::getMediaDetail($this->wg->Title);
         $isVideo = WikiaFileHelper::isVideoFile($file);
         $isImage = $detail['mediaType'] == 'image' && !$isVideo;
         $metadata = $file->getMetadata();
         if ($metadata !== "0") {
             $metadata = unserialize($metadata);
             $fileParams = array('description', 'keywords') + ($isVideo ? array('movieTitleAndYear', 'videoTitle') : array());
             foreach ($fileParams as $datum) {
                 $html .= isset($metadata[$datum]) ? ' ' . $metadata[$datum] : '';
             }
         }
     }
     $title = $page->getTitle()->getText();
     if (in_array($namespace, array(NS_WIKIA_FORUM_BOARD_THREAD, NS_USER_WALL_MESSAGE))) {
         $wm = WallMessage::newFromId($page->getId());
         $wm->load();
         if ($wm->isMain()) {
             $title = $wm->getMetaTitle();
         } else {
             if ($main = $wm->getTopParentObj() and !empty($main)) {
                 $main->load();
                 $title = $main->getMetaTitle();
             }
         }
     }
     // clear output buffer in case we want get more pages
     $this->wg->Out->clearHTML();
     $result['wid'] = empty($this->wg->ExternalSharedDB) ? $this->wg->SearchWikiId : (int) $this->wg->CityId;
     $result['pageid'] = $pageId;
     $result['id'] = $result['wid'] . '_' . $result['pageid'];
     $result['title'] = $title;
     $result['canonical'] = $canonical;
     $result['html'] = html_entity_decode($html, ENT_COMPAT, 'UTF-8');
     $result['url'] = $page->getTitle()->getFullUrl();
     $result['ns'] = $page->getTitle()->getNamespace();
     $result['host'] = substr($this->wg->Server, 7);
     $result['lang'] = $this->wg->Lang->mCode;
     # these need to be strictly typed as bool strings since they're passed via http when in the hands of the worker
     $result['iscontent'] = in_array($result['ns'], $this->wg->ContentNamespaces) ? 'true' : 'false';
     $result['is_main_page'] = $page->getId() == Title::newMainPage()->getArticleId() && $page->getId() != 0 ? 'true' : 'false';
     $result['is_redirect'] = $canonical == '' ? 'false' : 'true';
     $result['is_video'] = $isVideo ? 'true' : 'false';
     $result['is_image'] = $isImage ? 'true' : 'false';
     if ($this->wg->EnableBacklinksExt && $this->wg->IndexBacklinks) {
         $result['backlink_text'] = Backlinks::getForArticle($page);
     }
     $result = array_merge($result, $this->getPageMetaData($page));
     // restore global state
     $this->wg->Title = $wgTitle;
     $this->wg->Request = $wgRequest;
     wfProfileOut(__METHOD__);
     return $result;
 }
コード例 #13
0
ファイル: Linker.php プロジェクト: Tjorriemorrie/app
 /**
  * Given parameters derived from [[Image:Foo|options...]], generate the
  * HTML that that syntax inserts in the page.
  *
  * @param $title Title object
  * @param $file File object, or false if it doesn't exist
  * @param $frameParams Array: associative array of parameters external to the media handler.
  *     Boolean parameters are indicated by presence or absence, the value is arbitrary and
  *     will often be false.
  *          thumbnail       If present, downscale and frame
  *          manualthumb     Image name to use as a thumbnail, instead of automatic scaling
  *          framed          Shows image in original size in a frame
  *          frameless       Downscale but don't frame
  *          upright         If present, tweak default sizes for portrait orientation
  *          upright_factor  Fudge factor for "upright" tweak (default 0.75)
  *          border          If present, show a border around the image
  *          align           Horizontal alignment (left, right, center, none)
  *          valign          Vertical alignment (baseline, sub, super, top, text-top, middle,
  *                          bottom, text-bottom)
  *          alt             Alternate text for image (i.e. alt attribute). Plain text.
  *          caption         HTML for image caption.
  *          link-url        URL to link to
  *          link-title      Title object to link to
  *          link-target     Value for the target attribue, only with link-url
  *          no-link         Boolean, suppress description link
  *
  * @param $handlerParams Array: associative array of media handler parameters, to be passed
  *       to transform(). Typical keys are "width" and "page".
  * @param $time String: timestamp of the file, set as false for current
  * @param $query String: query params for desc url
  * @param $widthOption: Used by the parser to remember the user preference thumbnailsize
  * @return String: HTML for an image, with links, wrappers, etc.
  */
 public static function makeImageLink2(Title $title, $file, $frameParams = array(), $handlerParams = array(), $time = false, $query = "", $widthOption = null)
 {
     $res = null;
     $dummy = new DummyLinker();
     if (!wfRunHooks('ImageBeforeProduceHTML', array(&$dummy, &$title, &$file, &$frameParams, &$handlerParams, &$time, &$res))) {
         return $res;
     }
     if ($file && !$file->allowInlineDisplay()) {
         wfDebug(__METHOD__ . ': ' . $title->getPrefixedDBkey() . " does not allow inline display\n");
         return self::link($title);
     }
     // Shortcuts
     $fp =& $frameParams;
     $hp =& $handlerParams;
     // Clean up parameters
     $page = isset($hp['page']) ? $hp['page'] : false;
     if (!isset($fp['align'])) {
         $fp['align'] = '';
     }
     if (!isset($fp['alt'])) {
         $fp['alt'] = '';
     }
     if (!isset($fp['title'])) {
         $fp['title'] = '';
     }
     $prefix = $postfix = '';
     if ('center' == $fp['align']) {
         $prefix = '<div class="center">';
         $postfix = '</div>';
         $fp['align'] = 'none';
     }
     if ($file && !isset($hp['width'])) {
         if (isset($hp['height']) && $file->isVectorized()) {
             // If its a vector image, and user only specifies height
             // we don't want it to be limited by its "normal" width.
             global $wgSVGMaxSize;
             $hp['width'] = $wgSVGMaxSize;
         } else {
             $hp['width'] = $file->getWidth($page);
         }
         if (isset($fp['thumbnail']) || isset($fp['framed']) || isset($fp['frameless']) || !$hp['width']) {
             global $wgThumbLimits, $wgThumbUpright;
             if (!isset($widthOption) || !isset($wgThumbLimits[$widthOption])) {
                 $widthOption = User::getDefaultOption('thumbsize');
             }
             // Reduce width for upright images when parameter 'upright' is used
             if (isset($fp['upright']) && $fp['upright'] == 0) {
                 $fp['upright'] = $wgThumbUpright;
             }
             // For caching health: If width scaled down due to upright parameter, round to full __0 pixel to avoid the creation of a lot of odd thumbs
             $prefWidth = isset($fp['upright']) ? round($wgThumbLimits[$widthOption] * $fp['upright'], -1) : $wgThumbLimits[$widthOption];
             // Use width which is smaller: real image width or user preference width
             // Unless image is scalable vector.
             if (!isset($hp['height']) && ($hp['width'] <= 0 || $prefWidth < $hp['width'] || $file->isVectorized())) {
                 $hp['width'] = $prefWidth;
             }
         }
     }
     if (isset($fp['thumbnail']) || isset($fp['manualthumb']) || isset($fp['framed']) || WikiaFileHelper::isVideoFile($file)) {
         global $wgContLang;
         # Create a thumbnail. Alignment depends on language
         # writing direction, # right aligned for left-to-right-
         # languages ("Western languages"), left-aligned
         # for right-to-left-languages ("Semitic languages")
         #
         # If  thumbnail width has not been provided, it is set
         # to the default user option as specified in Language*.php
         if ($fp['align'] == '') {
             $fp['align'] = $wgContLang->alignEnd();
         }
         return $prefix . self::makeThumbLink2($title, $file, $fp, $hp, $time, $query) . $postfix;
     }
     if ($file && isset($fp['frameless'])) {
         $srcWidth = $file->getWidth($page);
         # For "frameless" option: do not present an image bigger than the source (for bitmap-style images)
         # This is the same behaviour as the "thumb" option does it already.
         if ($srcWidth && !$file->mustRender() && $hp['width'] > $srcWidth) {
             $hp['width'] = $srcWidth;
         }
     }
     if ($file && isset($hp['width'])) {
         # Create a resized image, without the additional thumbnail features
         $thumb = $file->transform($hp);
     } else {
         $thumb = false;
     }
     /**
      * Wikia change begin
      */
     $params = array();
     $origHTML = null;
     /**
      * Wikia change end
      */
     if (!$thumb) {
         /**
          * Wikia change start
          * @author Federico
          */
         $s = $origHTML = self::makeBrokenImageLinkObj($title, $fp['title'], '', '', '', $time == true);
         /**
          * Wikia change end
          */
     } else {
         $params = array('alt' => $fp['alt'], 'title' => $fp['title'], 'valign' => isset($fp['valign']) ? $fp['valign'] : false, 'img-class' => isset($fp['border']) ? 'thumbborder' : false);
         $params = self::getImageLinkMTOParams($fp, $query) + $params;
         /**
          * Wikia change start
          * @author Federico
          */
         if (F::app()->checkSkin('wikiamobile')) {
             $origHTML = $s = $thumb->toHtml($params);
         } else {
             $origHTML = $s = $thumb->renderView($params);
         }
         /**
          * Wikia change end
          */
     }
     if ($fp['align'] != '') {
         $s = "<div class=\"float{$fp['align']}\">{$s}</div>";
     }
     /* Wikia change begin - @author: Federico "Lox" Lucignano */
     if (F::app()->checkSkin('wikiamobile')) {
         /* Give extensions the ability to add HTML to full size unframed images */
         wfRunHooks('ImageAfterProduceHTML', array($frameParams, $thumb, $origHTML, &$s));
     }
     /* Wikia change end */
     return str_replace("\n", ' ', $prefix . $s . $postfix);
 }