Path variations.
Used as `{{ $file->path }}` or `{{ $image->getPathAttribute('thumb') }}`.

@param  string|null $thumbSize Thumbnail size for image file.
@return string|null
499600
public function getPathAttribute($thumbSize = null)
    {
        $path = $this->path($thumbSize);

        return $this->storageDisk()->exists($path) ? $path : null;
    }
161448
def build_thumb_path(self, image):
        
        image_file = image.file
        image_name_w_ext = split(image.name)[-1]
        image_name, ext = splitext(image_name_w_ext)
        if not self.in_memory(image_file):
            # `image_file` is already in disk (not in memory).
            # `image_name` is the full path, not just the name
            image_name = image_name.split('/')[-1]
        upload_to = image.field.upload_to
        if not upload_to.endswith('/'):
            upload_to = f'{upload_to}/'
        path_upload_to = f'{upload_to}{image_name}'
        return f'{self.storage.location}/{path_upload_to}{THUMB_EXT}{ext}'
1241412
protected function thumbnailName()
    {
    	$file = explode('.', $this->image);

		$fileName = Arr::first($file);
		$fileExt = Arr::last($file);

		return $fileName
    		. ($this->width() ? '_w' . $this->width() : '')
    		. ($this->height() ? '_h' . $this->height() : '')
    		. '.' . $fileExt;
    }
50807
public function pathinfo($option = null)
    {
        if (null === $option) {
            return pathinfo($this->_filePath);
        }
        return pathinfo($this->_filePath, $option);
    }
897170
public function getThumbnail(FileStorage $entity, string $version) : string
    {
        $versions = (array)Configure::read('FileStorage.imageHashes.file_storage');
        if (empty($versions)) {
            return str_replace(DS, '/', $entity->get('path'));
        }

        if (! array_key_exists($version, $versions)) {
            return str_replace(DS, '/', $entity->get('path'));
        }

        $path = in_array(strtolower($entity->get('extension')), self::IMAGE_EXTENSIONS) ?
            $this->getImagePath($entity, $version) :
            $this->getIconPath($entity, $version);

        return str_replace(DS, '/', $path);
    }
1024322
public function parsePath(?string $path = null): ?string
    {
        if ($path === null) {
            return null;
        }
        $path = \str_replace('%DOCUMENT_ROOT%', $this->documentRoot, $path);
        $path = \str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $path);
        return $path;
    }
612605
private function getThumbnailUri(Thumbnail $thumb)
    {
        $fileName = $thumb->getFileName();
        if ($fileName === null || $fileName === '') {
            return false;
        }

        return $this->urlGenerator->generate(
            'thumb',
            [
                'width'  => $thumb->getWidth(),
                'height' => $thumb->getHeight(),
                'action' => $thumb->getScale(),
                'file'   => $thumb->getFileName(),
            ]
        );
    }
120687
public function filter($path, $sizing, $inset = true, $default = null)
    {
        if ($path instanceof ImageInterface) {
            $path = $path->getPath();
        }

        if (empty($path) && $default) {
            return $default;
        }

        if (empty($path)) {
            return $this->defaultImage;
        }

        $runtimeConfig = [
            'thumbnail' => [
                'size' => explode('x', strtolower($sizing)),
                'mode' => $inset ? 'inset' : 'outbound',
            ],
        ];

        return $this->cacheManager->getBrowserPath($path, $this->filter, $runtimeConfig);
    }
150311
public function getPath($hint = null)
    {
        if (!is_null($hint)) {
            return $this->path.'/'.$hint;
        }

        return $this->path;
    }
29012
private function getThumbnail($fileName = null, $width = null, $height = null, $scale = null)
    {
        $thumb = new Thumbnail($this->config->get('general/thumbnails'));
        $thumb
            ->setFileName($fileName)
            ->setWidth($width)
            ->setHeight($height)
            ->setScale($scale)
        ;

        return $thumb;
    }
772812
static function getThumb(File $file, Config $config) {
		$path = $file->getFolder();

		if (!is_dir($path . $config->thumbFolderName)) {
			mkdir($path . $config->thumbFolderName, 0777);
		}

		$thumbName = $path . $config->thumbFolderName . Consts::DS . $file->getName();
		if (!$file->isImage()) {
			$thumbName = $path . $config->thumbFolderName . Consts::DS . $file->getName() . '.png';
		}

		if (!file_exists($thumbName)) {
			if ($file->isImage()) {
				try {
					$img = new SimpleImage($file->getPath());
					$img
						->best_fit(150, 150)
						->save($thumbName, $config->quality);
				} catch (\Exception $e) {
					return $file;
				}
			} else {
				self::generateIcon($file, $thumbName);
			}
		}

		return new File($thumbName);
	}
995006
public function getThumbnail($size) {
		switch ($size) {
			case 'thumb':
				$thumb = $this->thumbnail;
				break;
			case 'small':
				$thumb = $this->smallthumb;
				break;
			case 'large':
				$thumb = $this->largethumb;
				break;
			default:
				return '';
				break;
		}

		if (!$thumb) {
			return '';
		}

		$file = new ElggFile();
		$file->owner_guid = $this->getOwnerGUID();
		$file->setFilename($thumb);
		return $file->grabFile();
	}
1229680
public function variantPath($variant = null)
    {
        $variant = $variant ?: FileHandler::ORIGINAL;

        $target = $this->getOrMakeTargetInstance();

        if ($variant == FileHandler::ORIGINAL) {
            return $target->original();
        }

        return $target->variant($variant);
    }
95733
protected function getPathFromConfiguration($path, ConfigurationInterface $configuration)
    {
        if ($configuration->hasRelativePath()) {
            return $configuration->getRelativePathToFile($path);
        }

        if ($configuration->hasPublicURL()) {
            return $configuration->getPublicURLToFile($path);
        }

        throw new \InvalidArgumentException('Thumbnail configuration doesn\'t support Paths or URLs');
    }
312683
public function getImageUrl($size = 'thumbnail')
    {
        $res = wp_get_attachment_image_src($this->getId(), $size);
        return $res && isset($res[0]) ? $res[0] : null;
    }
943011
function saveThumbnail($ThumbFile)
    {
        $ThumbFile = trim($ThumbFile);
        $file = basename($this->file);

        if (empty($ThumbFile))
        {
            $ThumbFile = "th_$file";
        }

        if (!empty($this->ImageInfo["h"]["Thumbnail"]))
        {
            $tp = fopen($ThumbFile, "wb");
            if (!$tp)
            {
                $this->errno = 2;
                $this->errstr = "Cannot Open file '$ThumbFile'";
            }
            fwrite($tp, $this->ImageInfo["h"]["Thumbnail"]);
            fclose($tp);
            touch($ThumbFile, filemtime($this->file));
        }
        //$this->thumbnailURL = $ThumbFile;
        $this->ImageInfo["h"]["Thumbnail"] = $ThumbFile;
    }
165451
protected function getStoredThumbnailPath($file_id, $version_id, $storage_location_id, $thumbnail_handle, $format)
    {
        $builder = $this->connection->createQueryBuilder();
        $query = $builder
            ->select('path')->from('FileImageThumbnailPaths', 'p')
            ->where('p.fileID = :file')
            ->andWhere('p.fileVersionID = :version')
            ->andWhere('p.storageLocationID = :storage')
            ->andWhere('p.thumbnailTypeHandle = :thumbnail')
            ->andWhere('p.thumbnailFormat = :format')
            ->setParameters(array(
                'file' => $file_id,
                'version' => $version_id,
                'storage' => $storage_location_id,
                'thumbnail' => $thumbnail_handle,
                'format' => $format,
            ))->execute();

        if ($query->rowCount()) {
            return $query->fetchColumn();
        }

        return null;
    }