/**
  * @desc Returns normal image URL made from thumbnail
  *
  * @param String $thumbUrl thumbnail image's URL
  * @return String new URL
  */
 public static function getFileUrlFromThumbUrl($thumbUrl)
 {
     if (VignetteRequest::isVignetteUrl($thumbUrl)) {
         return VignetteRequest::fromUrl($thumbUrl, true)->url();
     } elseif (self::IsExternalThumbnailUrl($thumbUrl)) {
         $imageUrl = str_replace('/images/thumb/', '/images/', $thumbUrl);
         return preg_replace('~/[^/]+$~', '', $imageUrl);
     } else {
         return $thumbUrl;
     }
 }
Example #2
0
 private function createVignetteThumbnail($file, $cropPosition)
 {
     return VignetteRequest::fromUrl($file->getFullUrl())->windowCrop()->width(self::WIKI_HERO_IMAGE_MAX_WIDTH)->xOffset(0)->yOffset(round($file->getHeight() * $cropPosition))->windowWidth($file->getWidth())->windowHeight(round($file->getWidth() / 4))->url();
 }
 /**
  * @expectedException InvalidArgumentException
  */
 public function testBadThumbnailDefinition()
 {
     $this->mockGlobalVariable('wgVignetteUrl', $this->vignetteUrl);
     VignetteRequest::fromUrl("{$this->vignetteUrl}/tests/images/a/ab/SomeFile.jpg/revision/latest/thumbnail/width/100/height");
 }