Esempio n. 1
0
 /**
  * @param string $vignetteResult
  * @param string $legacyDefinition
  * @dataProvider legacyThumbDefinitions
  */
 public function testApplyLegacyThumbDefinition($vignetteResult, $legacyDefinition)
 {
     $this->mockGlobalVariable('wgVignetteUrl', $this->vignetteUrl);
     $baseUrl = "{$this->vignetteUrl}/tests/images/a/ab/filename.jpg/revision/latest";
     $generator = VignetteRequest::fromConfigMap(['relative-path' => 'a/ab/filename.jpg', 'bucket' => 'tests', 'timestamp' => '123', 'domain-shard-count' => 1]);
     $actual = VignetteRequest::applyLegacyThumbDefinition($generator, $legacyDefinition)->url();
     $this->assertEquals("{$baseUrl}/{$vignetteResult}", $actual);
 }
 /**
  * Get a URL to access the thumbnail
  * This is required because the model of how files work requires that
  * the thumbnail urls be predictable. However, in our model the URL is not based on the filename
  * (that's hidden in the db)
  * Wikia change:
  *		Use our external thumbnailer for UploadStashFiles
  *		We need to look into temp directory while upload stash is saving file there
  *
  * @param String $suffix string that will be added at the end of path
  * @return String: URL to access thumbnail, or URL with partial path
  */
 public function getThumbUrl($suffix = false)
 {
     global $wgEnableVignette;
     if ($wgEnableVignette) {
         $generator = VignetteRequest::applyLegacyThumbDefinition($this->getUrlGenerator(), $suffix);
         $path = $generator->url();
     } else {
         $path = $this->repo->getZoneUrl('thumb') . '/temp/' . $this->getUrlRel();
         if ($suffix !== false) {
             $path .= '/' . rawurlencode($suffix);
         }
     }
     return $path;
 }