Get raw image attribute based on its path on file storage

@param $path string
@return string
766802
public static function getRawImage($path)
    {
        $disk = config('filesystems.default');

        /** @var \Illuminate\Filesystem\FilesystemAdapter $storage */
        $storage = Storage::disk($disk);

        // Check that the path is valid
        if (! $storage->exists($path)) {
            return '';
        }

        // Fetch the raw data from the storage
        $mime_type = $storage->mimeType($path);
        $raw_image = "data:$mime_type;base64," . base64_encode($storage->get($path));
        return $raw_image;
    }
1265177
public function getRealPath($path)
    {
        $existentPath = $this->normalizePath($path);
        $tail = [];

        $pathArray = explode('/', $existentPath);
        while (!file_exists($existentPath)) {
            array_unshift($tail, array_pop($pathArray));
            $existentPath = implode('/', $pathArray);
        }

        return str_replace(
            \DIRECTORY_SEPARATOR,
            '/',
            $existentPath . '/' . implode(\DIRECTORY_SEPARATOR, $tail)
        );
    }
301557
private function encodePath($path)
    {
        $path = $this->normalisePath($path);
        $path = str_replace('%2F', '/', rawurlencode($path));
        return $path;
    }
548333
public function storagePath($path = '')
    {
        if (defined('THEMOSIS_ROOT')) {
            return $this->rootPath('storage').($path ? DIRECTORY_SEPARATOR.$path : $path);
        }

        return $this->contentPath('storage').($path ? DIRECTORY_SEPARATOR.$path : $path);
    }
636745
protected function get_thumbnail_path($path) {
        $relative_path = $this->getRelativePath($path);
        $thumbnail_path = $this->path_to_files . '/' . $this->config['images']['thumbnail']['dir'] . '/';

        if (is_dir($path)) {
            $thumbnail_fullpath = $thumbnail_path . $relative_path . '/';
        } else {
            $thumbnail_fullpath = $thumbnail_path . dirname($relative_path) . '/' . basename($path);
        }

        return $this->cleanPath($thumbnail_fullpath);
    }
681747
private function filterPath($path)
    {
        if ($path != null && substr($path, 0, 1) !== '/') {
            $path = '/' . $path;
        }

        return preg_replace_callback(
            '/(?:[^' . self::$charUnreserved . ':@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/',
            function ($match) { return rawurlencode($match[0]); },
            $path
        );
    }
1151530
public function getMetadata($path)
    {
        [$prefix, $path] = $this->getPrefixAndPath($path);

        return $this->getFilesystem($prefix)->getMetadata($path);
    }
829051
protected function getObjectUrl($path)
    {
        return $this->storage->getObjectUrl($this->bucket, $path, 0, $this->getOptions);
    }
906622
private function getValidPath($path)
    {
        // If `$path` is array
        if (is_array($path)) {
            return $this->getPathFromArray($path);
        }

        // If `$path` is a directory
        if (is_dir($path)) {
            $paths = glob($path . '/*.*');
            if (empty($paths)) {
                throw new EmptyDirectoryException("Configuration directory: [$path] is empty");
            }
            return $paths;
        }

        // If `$path` is not a file, throw an exception
        if (!file_exists($path)) {
            throw new FileNotFoundException("Configuration file: [$path] cannot be found");
        }
        return array($path);
    }
58031
protected function getPath($path)
	{
		$paths = array();

		// If `$path` is an array
		if (is_array($path))
		{
			foreach ($path as $unverifiedPath)
			{
				$paths = array_merge($paths, $this->getPath($unverifiedPath));
			}

			return $paths;
		}

		// If `$path` is a directory
		if (is_dir($path))
		{
			$paths = glob($path . '/*.*');

			return $paths;
		}

		// If `$path` is a file
		if (file_exists($path))
		{
			$paths[] = $path;
		}

		return $paths;
	}
1310147
public function getStoragePath($path = '')
    {
        //prepend the path with a \/
        if (strlen($path)) {
            $path = '/'.$path;
        }

        $base = $this->_mixer->id;

        //for ownable entities, use the owner component to prefix
        //the path
        if ($this->_mixer->isOwnable()) {
            $path = '/'.$this->_mixer->component.$path;
            $base = $this->_mixer->owner->id;
        }

        return 'n'.$base.$path;
    }
1314073
public static function data_uri(string $path) {
		ref\cast::string($path, true);
		ref\file::path($path, true);

		if ((false !== $path) && @\is_file($path)) {
			$content = \base64_encode(@\file_get_contents($path));
			$finfo = mime::finfo($path);

			return "data:{$finfo['mime']};base64,{$content}";
		}

		return false;
	}
556400
public static function cleanFilePathname($path) {
		if (UString::isNotNull ( $path )) {
			if (\DS === "/")
				$path = \str_replace ( "\\", \DS, $path );
			else
				$path = \str_replace ( "/", \DS, $path );
			$path = \str_replace ( \DS . \DS, \DS, $path );
		}
		return $path;
	}
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;
    }
1091208
public static function stripExt($path) {
        if (mb_strpos($path, '.') !== false) {
            $path = mb_substr($path, 0, mb_strrpos($path, '.'));
        }

        return $path;
    }
1113812
private function getPath($path)
    {
        $uri = parse_url($path);

        $stream = $this->getStreamByPathScheme($path);
        if ($stream instanceof StreamInterface) {
            foreach ($stream->getPaths() as $streamDomain => $streamPath) {
                if ($streamDomain === $uri['host']) {
                    $realPath = $this->getRealPath($uri, $streamPath);
                    if (strpos($realPath, $streamPath) === 0) {
                        return $realPath;
                    }
                }
            }
        }
    }
767967
public function get($path)
    {
        $path = self::validatePath($path);
        $fullPath = $this->getMediaPath($path);
        return $this->getStorageDisk()->get($fullPath);
    }