public function getListForVisualization($langCode)
 {
     return WikiaDataAccess::cache($this->getCollectionsListVisualizationCacheKey($langCode), 6 * 60 * 60, function () use($langCode) {
         $list = $this->getList($langCode);
         foreach ($list as &$collection) {
             if (!empty($collection['sponsor_hero_image'])) {
                 $collection['sponsor_hero_image'] = ImagesService::getLocalFileThumbUrlAndSizes($collection['sponsor_hero_image'], 0, ImagesService::EXT_JPG);
             }
             if (!empty($collection['sponsor_image'])) {
                 $collection['sponsor_image'] = ImagesService::getLocalFileThumbUrlAndSizes($collection['sponsor_image'], 0, ImagesService::EXT_JPG);
             }
             $collection['wikis'] = $this->getWikisFromCollection($collection['id']);
         }
         return $list;
     });
 }
 /**
  * @group Slow
  * @slowExecutionTime 0.03929 ms
  * @dataProvider getLocalFileThumbUrlAndSizesDataProvider
  */
 public function testGetLocalFileThumbUrlAndSizes($destImageWidth, $image, $results)
 {
     $titleGetTextResult = 'TEST TEXT';
     $fileGetThumbUrlResult = 'TEST_URL';
     $titleMock = $this->getMock('Title', array('getText'), array(), '', false);
     $titleMock->expects($this->any())->method('getText')->will($this->returnValue($titleGetTextResult));
     $fileMock = $this->getMock('WikiaLocalFile', array('getWidth', 'getHeight', 'createThumb'), array(), '', false);
     $fileMock->expects($this->once())->method('getWidth')->will($this->returnValue($image['width']));
     $fileMock->expects($this->once())->method('getHeight')->will($this->returnValue($image['height']));
     $fileMock->expects($this->once())->method('createThumb')->will($this->returnValue($fileGetThumbUrlResult));
     $this->mockGlobalFunction('wfFindFile', $fileMock);
     $expected = new stdClass();
     $expected->width = $results['width'];
     $expected->height = $results['height'];
     $expected->title = $titleGetTextResult;
     $expected->url = $fileGetThumbUrlResult;
     $result = ImagesService::getLocalFileThumbUrlAndSizes($titleGetTextResult, $destImageWidth);
     $this->assertEquals($result, $expected);
 }
 protected function getImageInfo($fileName, $destSize = 0)
 {
     return ImagesService::getLocalFileThumbUrlAndSizes($fileName, $destSize, ImagesService::EXT_JPG);
 }
 /**
  * Get saved images for marketing slots
  *
  * @param $marketingSlots
  * @return array
  */
 private function prepareMarketingSlotImages($marketingSlots)
 {
     $marketingImages = [];
     if (!empty($marketingSlots)) {
         foreach ($marketingSlots as $key => $slot) {
             if (!empty($slot['marketing_slot_image'])) {
                 $photo = ImagesService::getLocalFileThumbUrlAndSizes($slot['marketing_slot_image'], 149, ImagesService::EXT_JPG);
                 $marketingImages[$key] = $photo->url;
             }
         }
     }
     return $marketingImages;
 }
 /**
  * @param integer $destImageWidth
  * @return stdClass (simple stdObject with fields: title, url, width and height)
  */
 public function getImageThumbData($destImageWidth = 0)
 {
     return ImagesService::getLocalFileThumbUrlAndSizes($this->getFileName(), $destImageWidth, ImagesService::EXT_JPG);
 }
 /**
  * @desc Used by WMU to get the image url
  */
 public function getImageDetails()
 {
     if (!$this->checkAccess()) {
         return false;
     }
     wfProfileIn(__METHOD__);
     $fileName = $this->getVal('fileHandler', false);
     if ($fileName) {
         $imageData = ImagesService::getLocalFileThumbUrlAndSizes($fileName, $this->editHubModel->getThumbnailSize(), ImagesService::EXT_JPG);
         $this->fileUrl = $imageData->url;
         $this->imageWidth = $imageData->width;
         $this->imageHeight = $imageData->height;
         $this->fileTitle = $imageData->title;
     }
     wfProfileOut(__METHOD__);
 }
 /**
  * @desc This is exactly the same as in WikiaHubsModuleService class
  * and is here only for testing purposes
  *
  * @param $image
  * @param int $destSize
  * @return stdClass
  */
 public function getImageInfo($image, $destSize = 0)
 {
     return ImagesService::getLocalFileThumbUrlAndSizes($image, $destSize, ImagesService::EXT_JPG);
 }