public static function resolveUrl(AssetInterface $asset, $url)
    {
        // given URL is absolute URL
        if (false !== strpos($url, '://')) {
            return $url;
        }

        // source directory of the asset
        $root = dirname($asset->getSourceRoot().'/'.$asset->getTargetPath());

        // path directory where asset is being copied
        $path = dirname($asset->getTargetPath());

        if ('.' === $path) {
            $image = $url;
        } else {
            $image = $path.'/'.$url;
        }

        if (null !== $root) {
            $image = $root.'/'.$url;
        }

        // cleanup local URLs
        if (false === strpos($image, '://')) {
            $image = self::removeQueryString($image);
            $image = self::removeAnchor($image);

            return self::resolveUps($image);
        }

        return $image;
    }
public static function resolveUrl(AssetInterface $asset, $url)
    {
        // given URL is absolute URL
        if (false !== strpos($url, '://')) {
            return $url;
        }

        // source directory of the asset
        $root = dirname($asset->getSourceRoot().'/'.$asset->getTargetPath());

        // path directory where asset is being copied
        $path = dirname($asset->getTargetPath());

        if ('.' === $path) {
            $image = $url;
        } else {
            $image = $path.'/'.$url;
        }

        if (null !== $root) {
            $image = $root.'/'.$url;
        }

        // cleanup local URLs
        if (false === strpos($image, '://')) {
            $image = self::removeQueryString($image);
            $image = self::removeAnchor($image);

            return self::resolveUps($image);
        }

        return $image;
    }
public static function resolveUrl ( AssetInterface $ asset , $ url ) { // given URL is absolute URL if ( false !== strpos ( $ url , '://' ) ) { return $ url ; } // source directory of the asset $ root = dirname ( $ asset -> getSourceRoot ( ) . '/' . $ asset -> getTargetPath ( ) ) ; // path directory where asset is being copied $ path = dirname ( $ asset -> getTargetPath ( ) ) ; if ( '.' === $ path ) { $ image = $ url ; } else { $ image = $ path . '/' . $ url ; } if ( null !== $ root ) { $ image = $ root . '/' . $ url ; } // cleanup local URLs if ( false === strpos ( $ image , '://' ) ) { $ image = self :: removeQueryString ( $ image ) ; $ image = self :: removeAnchor ( $ image ) ; return self :: resolveUps ( $ image ) ; } return $ image ; }
Resolves an URL from an asset.

@param AssetInterface $asset the asset containing the URL
@param string         $url   url read in file

@return string an URL, a filepath
Resolves an URL from an asset .