@param string $path

@return Image
325424
private function autoRotate(string $path): self
    {
        $exifData = exif_read_data($path);
        if (false !== $exifData && true === array_key_exists('Orientation', $exifData)) {
            $imageData = null;
            switch ($exifData['Orientation']) {
                case self::ORIENTATION_UPSIDE_DOWN:
                    $imageData = imagerotate($this->workingData, 180, 0);
                    break;
                case self::ORIENTATION_ROTATE_COUNTER_CLOCKWISE:
                    $imageData = imagerotate($this->workingData, -90, 0);
                    break;
                case self::ORIENTATION_ROTATE_CLOCKWISE:
                    $imageData = imagerotate($this->workingData, 90, 0);
                    break;
            }
            if (null !== $imageData) {
                $this->workingData = $imageData;
            }
        }
        return $this;
    }
613370
public function image64($path)
    {
        $file = new File($path, false);
        
        if (!$file->isFile() || 0 !== strpos($file->getMimeType(), 'image/')) {
            return;
        }
        
        $binary = file_get_contents($path);
        
        return sprintf('data:image/%s;base64,%s', $file->guessExtension(), base64_encode($binary));
    }
1040090
static public function forge($path){
        switch(mimetype($path)) {
            case 'image/jpeg':
                return new Image(new Adapter\JPEG($path));
                break;
            case 'image/png':
                return new Image(new Adapter\PNG($path));
                break;
            case 'image/gif':
                return new Image(new Adapter\GIF($path));
                break;
            default:
                throw new Exception("'$path' image file is not supported");
        }
	}
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;
    }
1202564
public function getFile($path) {
		$dirPath = realpath($this->path);
		
		if ($dirPath === false) {
			throw new InvalidPath('Path "' . $this->path . '" doesn\'t exists or inaccsessible', null, null, $this->path);
		}
		
		return new File($dirPath . DIRECTORY_SEPARATOR . $path);
	}
721618
protected function openStream(/*# string */ $path)
    {
        if (is_string($path)) {
            if (false !== strpos($path, '://')) {
                $path = 'file://' . $path;
            }
            return fopen($path, 'a');
        }
        return $path;
    }
1091208
public static function stripExt($path) {
        if (mb_strpos($path, '.') !== false) {
            $path = mb_substr($path, 0, mb_strrpos($path, '.'));
        }

        return $path;
    }
1327718
private static function load($path)
    {
        $path = str_replace('.', '/', $path);

        $path = FULL_PATH . $path;

        if(substr($path, -4) != '.php')
        {
            $path = $path . '.php';
        }

        return $path;
    }
53151
public function getImage($path, $throwException = true)
    {
        if ($path instanceof ImageInterface) {
            return $path;
        }

        $file = $this->getFile($path, $throwException);
        if ($file) {
            return $this->filesystem->getImage($file->getFullPath());
        }

        return null;
    }
262295
public function withPath($path)
    {
        if (!is_string($path)) {
            throw new \InvalidArgumentException('Invalid path provided; must be a string');
        }
        $path = $this->filterPath($path);

        $new = clone $this;
        $new->path = $path;

        return $new;
    }
371287
public function loadFrom($path)
    {
        // Avoid repeat load of broken images
        $hash = sha1($path);
        if ($this->hasFailed($hash, null)) {
            return $this;
        }

        // Handle resource
        $error = self::FAILED_UNKNOWN;
        try {
            $this->setImageResource($this->getImageManager()->make($path));
            $this->markSuccess($hash, null);
            $error = null;
        } catch (NotReadableException $ex) {
            // Handle unsupported image encoding on load (will be marked as failed)
            // Unsupported exceptions are handled without being raised as exceptions
            $error = self::FAILED_INVALID;
        } finally {
            if ($error) {
                $this->markFailed($hash, null, $error);
            }
        }

        return $this;
    }
1115518
public function path($path = '')
    {
        $this->_sty->setTemplateDir($path);
        $this->root = $path;
        return $this;
    }
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;
    }
790332
public static function fromFile($path)
    {
        return new self($path, filesize($path), \DateTime::createFromFormat('U', filemtime($path)));
    }
1071674
public function render($path)
	{
		$file = static::get($path);
		
		$mime = static::mime($path);
		
		return \Response::make($file, 200, array(
			'Content-Type' => $mime,
		));
	}
679548
protected function getImage( $path = null )
    {
        if ( is_null( $this->image ) )
        {
            if ( is_null( $path ) )
            {
                $this->image = Image::create(
                    $this->width,
                    $this->height
                );
            }
            else
            {
                $this->image = Image::open( $path );
            }
        }

        return $this->image;
    }
70941
public function getAssetUrl($path)
    {
        if (false !== strpos($path, '://') || 0 === strpos($path, '//')) {
            return $path;
        }

        if (!$this->container->has('request')) {
            return $path;
        }

        if ('/' !== substr($path, 0, 1)) {
            $path = '/' . $path;
        }

        $request = $this->container->get('request');
        $path = $request->getBasePath() . $path;

        return $path;
    }