@param string $path

@return Image
352353
private function loadFromPath(string $path): self
    {
        switch ($this->extension) {
            case self::FORMAT_JPEG:
                $this->createFromJpeg($path);
                break;
            case self::FORMAT_PNG:
                $this->createFromPng($path);
                break;
            case self::FORMAT_GIF:
                $this->createFromGif($path);
                break;
            case self::FORMAT_WD_IMAGE:
                $this->createFromEncrypted($path);
                break;
            default:
                throw new ImageException('This image format is not supported!');
        }
        return $this;
    }
983495
public function file($path)
	{
		$absolutePath = Asset::isJavascript($path);
		if ($absolutePath) {
			return $this->javascript($absolutePath);
		}

		$absolutePath = Asset::isStylesheet($path);
		if ($absolutePath) {
			return $this->stylesheet($absolutePath);
		}

		$absolutePath = Asset::isFile($path);
		if ($absolutePath)
		{
			$this->clientCacheForFile($absolutePath);
			return new BinaryFileResponse($absolutePath, 200);
		}

		App::abort(404);
	}
140422
public static function create($path)
    {
        $file = new static($path);

        if (! is_dir(dirname($path))) {
            mkdir(dirname($path), 0755, true);
        }

        if (! $file->exists()) {
            touch($path);
        }

        return $file;
    }
397584
protected function get_imageinfo_from_path($path) {
        $imageinfo = getimagesize($path);

        $image = array(
                'width'     => $imageinfo[0],
                'height'    => $imageinfo[1],
                'mimetype'  => image_type_to_mime_type($imageinfo[2]),
            );
        if (empty($image['width']) or empty($image['height']) or empty($image['mimetype'])) {
            // GD can not parse it, sorry.
            return false;
        }
        return $image;
    }
17754
public static function getAssetUrl(string $path = '') : string
    {
        if (static::$assetUrl === null) {
            static::$assetUrl = FileHelper::getAssetUrl(static::className());
        }
        ;
        return static::$assetUrl . $path;
    }
179669
public function write($path)
  {
    if ($this->srcImage->getExtension() == Image::IMAGE_TYPE_JPG) {
      imagejpeg($this->cuttedRessource, $path, $this->srcImage->getJpgQuality());
    } else if ($this->srcImage->getExtension() == Image::IMAGE_TYPE_PNG) {
      imagepng($this->cuttedRessource, $path, $this->srcImage->getPngCompression());
    } else {
      throw new \Exception('Impossible de générer l\'image : extension non supportée');
    }
  }
957858
private function sanitizeRootPath(string $path): string
    {
        if (!empty($path) && false !== $real = realpath($path)) {
            return $real;
        }

        throw new InvalidArgumentException(sprintf('Root image path not resolvable "%s"', $path));
    }
921954
public static function parseQueryPath($path)
    {
        $path = '/' . ltrim($path, '/');
        $path = preg_replace('/[\x00-\x1F\x7F]/', '', $path);

        //examples:
        //1.> /images/../foo.png
        //2.> /foo.png

        //1.> /images/../../foo.png
        //2.> /foo.png
        //3.> false
        while (false !== $pos = strpos($path, '/../')) {
            $leftSlashNext = strrpos(substr($path, 0, $pos), '/');

            if (false === $leftSlashNext) {
                // one /../ too much, without space to the left/up
                return false;
            }

            $path = substr($path, 0, $leftSlashNext + 1) . substr($path, $pos + 4);
        }

        return $path;
    }
1314018
private function createDir($path) {
        $dir = $path;
        if (!is_dir($dir)) {
            $old = umask(0);
            mkdir($dir,0777,true);
            umask($old);
            chmod($dir, 0777);
        }
        return $dir;
    }
1042293
public function getImageFileAltProperties($path)
    {
        $properties = new FilePropertyEntityRepository;
        $properties->setWherePath($path);
        $properties->addWhereFieldIsLike('key', 'alt_', false);

        return $properties;
    }
1329099
public function image($path)
    {
        if (gplcart_path_is_absolute($path)) {
            $file = $path;
            $url = gplcart_path_relative($path);
        } else {

            $path = gplcart_path_normalize($path);
            $prefix = gplcart_path_relative(GC_DIR_FILE);

            if (strpos($path, "$prefix/") === 0) {
                $url = $path;
                $file = gplcart_file_absolute($path);
            } else {
                $url = "$prefix/$path";
                $file = gplcart_path_absolute($path);
            }
        }

        $query = is_file($file) ? array('v' => filemtime($file)) : array();

        return $this->get($url, $query, false, true);
    }
1353704
public function image($path, array $options = [])
    {
        $options = optionsParser($options, ['alt' => pathinfo($path, PATHINFO_BASENAME)])
            ->append('class', 'img-fluid')
            ->tooltip();

        return parent::image($path, $options->toArray());
    }
1371225
protected function get_thumbnail($path) {
        $thumbnail_fullpath = $this->get_thumbnail_path($path);

        // generate thumbnail if it doesn't exist or caching is disabled
        if (!file_exists($thumbnail_fullpath) || $this->config['images']['thumbnail']['cache'] === false) {
            $this->createThumbnail($path, $thumbnail_fullpath);
        }

        return $thumbnail_fullpath;
    }
1157974
public function initFromPath($path)
    {
        if ( ! file_exists($path)) {
            throw new \Intervention\Image\Exception\NotReadableException(
                "Unable to find file ({$path})."
            );
        }

        // get mime type of file
        $mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path);

        // define core
        switch (strtolower($mime)) {
            case 'image/png':
            case 'image/x-png':
                $core = @imagecreatefrompng($path);
                break;

            case 'image/jpg':
            case 'image/jpeg':
            case 'image/pjpeg':
                $core = @imagecreatefromjpeg($path);
                if (!$core) {
                    $core= @imagecreatefromstring(file_get_contents($path));
                }
                break;

            case 'image/gif':
                $core = @imagecreatefromgif($path);
                break;

            case 'image/webp':
            case 'image/x-webp':
                if ( ! function_exists('imagecreatefromwebp')) {
                    throw new \Intervention\Image\Exception\NotReadableException(
                        "Unsupported image type. GD/PHP installation does not support WebP format."
                    );
                }
                $core = @imagecreatefromwebp($path);
                break;

            default:
                throw new \Intervention\Image\Exception\NotReadableException(
                    "Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files."
                );
        }

        if (empty($core)) {
            throw new \Intervention\Image\Exception\NotReadableException(
                "Unable to decode image from file ({$path})."
            );
        }

        $this->gdResourceToTruecolor($core);

        // build image
        $image = $this->initFromGdResource($core);
        $image->mime = $mime;
        $image->setFileInfoFromPath($path);

        return $image;
    }
278870
public function get(string $path): File {
		return (new File(Paths::appendPath($this->getUrl(), $path)))->addFilters($this->recursiveFilter, true);
	}
361124
public function asset_url($path)
	{
		$url = $this->asset_path($path);

		if (filter_var($url, FILTER_VALIDATE_URL) === false)
		{
			$url = \Uri::create($url);
		}

		return $url;
	}
1154768
public function cleanThumbnails($path = '')
    {
        $cleanPathInfo = new SplFileInfo(realpath($this->getDocumentRoot() . DIRECTORY_SEPARATOR . $path));

        if (strpos($cleanPathInfo->getRealPath(), $this->getDocumentRoot()) === 0) {
            if ($cleanPathInfo->isDir()) {
                // Clean thumbnails in specified directory
                $dirIterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($cleanPathInfo->getRealPath()), RecursiveIteratorIterator::SELF_FIRST);

                foreach ($dirIterator as $path => $splFileObject) {
                    /* @var SplFileObject $splFileObject */
                    if (!in_array($splFileObject->getBasename(), ['.', '..'])
                        && preg_match('#.*-' . $this->getThumbnailPrefix() . '-([\w\d]+)\.(' . implode('|', $this->getAllowedExtensions()) . ')$#', $splFileObject->getBasename())
                    ) {
                        unlink($splFileObject->getRealPath());
                    }
                }

                return true;

            } elseif ($cleanPathInfo->isFile() && in_array($cleanPathInfo->getExtension(), $this->getAllowedExtensions())) {
                // Clean thumbnails for one image
                $imagePathRemExt = $cleanPathInfo->getPath() . DIRECTORY_SEPARATOR . $cleanPathInfo->getBasename('.' . $cleanPathInfo->getExtension());

                $thumbnails = glob($imagePathRemExt . '-' . $this->getThumbnailPrefix() . '-*');
                foreach ($thumbnails as $thumbnailPath) {
                    unlink($thumbnailPath);
                }

                return true;
            }
        }

        return false;
    }