This method will take an image path and build out the absolute path to that image
using the initial url we crawled so we can find a link to the image if they use relative urls like ../myimage.jpg

@param string $imageSrc

@return string
324007
private function buildImagePath(string $imageSrc): string {
        $parts = array(
            'scheme',
            'host',
            'port',
            'path',
            'query',
        );

        $imageUrlParts = parse_url($imageSrc);
        $articleUrlParts = parse_url($this->article()->getFinalUrl());
        if (isset($imageUrlParts['path'], $articleUrlParts['path']) && $imageUrlParts['path'] && $imageUrlParts['path']{0} !== '/') {
            $articleUrlDir = dirname($articleUrlParts['path']);
            $imageUrlParts['path'] = $articleUrlDir . '/' . $imageUrlParts['path'];
        }

        foreach ($parts as $part) {
            if (!isset($imageUrlParts[$part]) && isset($articleUrlParts[$part])) {
                $imageUrlParts[$part] = $articleUrlParts[$part];

            } else if (isset($imageUrlParts[$part]) && !isset($articleUrlParts[$part])) {
                break;
            }
        }

        return http_build_url($imageUrlParts, array());
    }
1313436
public function createImage($src, $alt = null)
    {
        $this->childNodes->push(new Image($src, $alt));

        return $this->childNodes->last();
    }
1367209
public function saveImage($imagePath, $saveDirPath, $separator = '-'): string
    {
        if (strpos($image = str_replace(' ', '%20', $imagePath), DIRECTORY_SEPARATOR) !== false) {
            $filename = str_replace('%20', $separator, pathinfo($image, PATHINFO_BASENAME));
            if (!empty($filename)) {
                $savePath = preg_replace(
                    '~/+~',
                    DIRECTORY_SEPARATOR,
                    implode(DIRECTORY_SEPARATOR, [$saveDirPath, $filename])
                );
                if (!file_exists($savePath)) {
                    try {
                        is_dir($saveDirPath) || mkdir($saveDirPath, 0777, true);
                        copy($image, $savePath);
                        return $savePath;
                    } catch (\Exception $e) {
                        if (strpos($_SERVER['argv'][0], 'phpunit') === false) {
                            echo 'Failed to download image, located at ' . $imagePath . ', Error: ' . $e->getMessage();
                            echo "\n";
                        }
                    }
                } else {
                    return $savePath;
                }
            }
        }
        return '';
    }
1105019
public function getUrlFromPath($assetPath)
    {
        // Ensure platform independency
        $path = str_replace('\\', '/', $assetPath);

        $filePath = pathinfo($path);

        $fileType = array_key_exists(strtolower($filePath['extension']), config('nodes.assets.providers.publicFolder.imageExtensionMimeTypes')) ? 'images' : 'data';

        // If the asset is type 'data', show the raw file. If it's 'image' we want to use the CDN
        if ($fileType == 'data') {
            return  $this->getUrlProtocol().config('nodes.assets.providers.publicFolder.domain').'/'.config('nodes.assets.providers.publicFolder.subFolder').'/'.$path;
        } else {
            $fileParts = explode('/', $path);

            return route('nodes.assets.public_folder.cdn', $fileParts);
        }
    }
1276761
public function setSource($src, $dir = null)
    {
        if (!isset($src)) {
            $this->imageSrc = null;
            $this->pathToImage = null;
            return $this;
        }

        if ($this->allowRemote && $this->isRemoteSource($src)) {
            $src = $this->downloadRemoteSource($src);
            $dir = null;
        }

        if (!isset($dir)) {
            $dir = dirname($src);
            $src = basename($src);
        }

        $this->imageSrc     = ltrim($src, '/');
        $imageFolder        = rtrim($dir, '/');
        $this->pathToImage  = $imageFolder . '/' . $this->imageSrc;

        return $this;
    }
652817
protected function getImageUrl()
    {
        $imageUrl = "";

        if ($this->getImagePath()) {
            $imageUrl = $this->getImageDirUrl() . $this->getImageName();
        }

        return $imageUrl;
    }
396384
def get_relative_image_path(self, path):
        

        if not path:
            return ""
        path = force_unix_path(self.get_abs_image_path(path))

        img_directory = self.get_images_directory()

        for directory in images_directories(self._NODE_TYPE):
            if os.path.commonprefix([directory, path]) == directory:
                relpath = os.path.relpath(path, directory)
                # We don't allow to recurse search from the top image directory just for image type directory (compatibility with old releases)
                if os.sep not in relpath or directory == img_directory:
                    return relpath
        return path
541327
public function setImageUrl($imageUrl)
    {
        $this->style    = null;
        $this->subStyle = null;
        $this->imageUrl = (string)$imageUrl;
        return $this;
    }
1021008
protected function getImageUrlOrDefault()
    {
        $imagePath = $this->entity->path;

        if (!Storage::exists($imagePath)) {
            $imagePath = $this->imgNotFound();
        }

        return Storage::url($imagePath);
    }
1049612
public function image($path, $imagestyle_id = null, $absolute = false)
    {
        return $this->image->getUrl($path, $imagestyle_id, $absolute);
    }
490232
public function info(string $src)
    {
        $image=$this->image($src);
        $info['width']=$image->getWidth();
        $info['height']=$image->getHeight();
        $info['orientation']=$image->getOrientation();
        $info['mime']=$image->getMimeType();
        $info['exif']=$image->getExif();
        return $info;
    }
270130
public function getImagePath()
    {
        if ($this->imagePath === null) {
            $this->imagePath = '/images/' . strtolower((new \ReflectionClass($this->owner))->getShortName());
        }
        return $this->imagePath;
    }
1108658
private function getRelativePathForResourceIcon($absolutePath)
    {
        if (empty($absolutePath)) {
            return null;
        }
        $pathInfo = pathinfo($absolutePath);

        return $this->fs->makePathRelative($pathInfo['dirname'], $this->webDir).$pathInfo['basename'];
    }
1114453
public function getImageUrl($imageModulePath)
    {
        /** @var \Magento\Framework\App\ObjectManager $om */
	$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
	/** @var \Magento\Framework\View\Asset\Repository */
	$viewRepository = $objectManager->get('\Magento\Framework\View\Asset\Repository');
	return $viewRepository->getUrl($imageModulePath);
    }
1001693
public function getSourcePath($path)
    {
        $path = trim($path, '/');
        
        $baseUrl = $this->baseUrl.'/';

        if (substr($path, 0, strlen($baseUrl)) === $baseUrl) {
            $path = trim(substr($path, strlen($baseUrl)), '/');
        }

        if ($path === '') {
            throw new FileNotFoundException('Image path missing.');
        }

        if ($this->sourcePathPrefix) {
            $path = $this->sourcePathPrefix.'/'.$path;
        }

        return rawurldecode($path);
    }
46672
protected function _getImagePath($sType)
    {
        $sFolder = array_key_exists($sType, $this->_aTypeToPath) ? $this->_aTypeToPath[$sType] : '0';

        return $this->normalizeDir(\OxidEsales\Eshop\Core\Registry::getConfig()->getPictureDir(false)) . "{$sFolder}/";
    }
614455
protected function getImageUrl(ImagePathInterface $path) {
	    $url = $path->getPath();
	    if ($this->getOption('use_prefix', false)) {
	        $url = rtrim($path->getPrefix(), '/') . '/' . $url;
	    }
	    if ($this->getOption('root_url')) {
	        $url = rtrim($this->getOption('root_url'), '/') . '/' . $url;
	    }
	    return filter_var($url, FILTER_SANITIZE_URL);
	}