Check if the image resource is a remote file or not.

@param string $src check if src is remote.

@return boolean true if $src is a remote file, else false.
966941
public function isRemoteSource($src)
    {
        $remote = preg_match($this->remotePattern, $src);
        $this->log("Detected remote image: " . ($remote ? "true" : "false"));
        return !!$remote;
    }
12522
protected static function isCertificateResource($resource): bool {
        if(!is_resource($resource)) {
            return FALSE;
        }
        if(get_resource_type($resource) != 'OpenSSL X.509') {
            return FALSE;
        }
        return TRUE;
    }
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;
    }
1368258
static function upToDate($src, $dest)
    {
        if (!file_exists($dest)) {
            return false;
        }

        if (filemtime($dest) >= filemtime($src)) {
            return true;
        }
        return false;
    }
468878
public function setSrc($src)
    {
        if (strpos($src, 'holder.js') !== false) {
            $parts = explode('/', $src);
            $size = end($parts);
            $this->attributes->addAttribute('data-src', $src);

            if ( ! $this->attributes->hasAttribute('alt')) {
                $this->setAlt($size);
            }
        } elseif (strpos($src, 'http')) {
            $this->attributes->addAttribute('src', $src);
        } elseif (is_file($src)) {
            $src = path_to_url($src);
            $this->attributes->addAttribute('src', $src);
        }

        return $this;
    }
880543
public function copy($src, $dst) {
		if(is_dir($src))
			return $this->copyDir($src, $dst);
		else {
			if(file_exists($dst)) {
				$dst = \Asgard\File\FileSystem::getNewFilename($odst = $dst);
				$this->output->writeln('<warning>The file '.$odst.' had to be renamed into '.$dst.'.</warning>');
			}

			\Asgard\File\FileSystem::mkdir(dirname($dst));
			$r = copy($src, $dst);

			if($r !== false)
				return $dst;
			return false;
		}
	}
253475
public function source($src)
    {
        $this->source = $this->getImageInfo($src);

        $type              = $this->source['type'];
        $createFrom        = 'ImageCreateFrom' . $type;
        $this->sourceImage = $createFrom($src);

        return $this;
    }
648634
public function sendFile($src)
    {
        $pointer = fopen($src, 'r');

        if (!is_resource($pointer)) {
            throw new RuntimeException("Unable to load '$src' for sending.");
        }

        $result = fpassthru($pointer);

        fclose($pointer);

        return $result;
    }
1286589
public function IsDerivedFrom( $src )
	{
		switch ( $src->TypeCode )
		{
			case XmlTypeCode::Node:
				if ( ! $this->IsNode )
					return false;
				break;

			case XmlTypeCode::AnyAtomicType:
			case XmlTypeCode::UntypedAtomic:
				if ( $this->IsNode )
					return false;
				break;

			case XmlTypeCode::Document:
				if ( $this->TypeCode != XmlTypeCode::Document || $this->SchemaElement != $src->SchemaElement)
					return false;
				break;

			case XmlTypeCode::Element:
				if ( $this->TypeCode != XmlTypeCode::Element || $this->SchemaElement != $src->SchemaElement)
					return false;
				break;

			case XmlTypeCode::Attribute:
				if ($this->TypeCode != XmlTypeCode::Attribute || $this->SchemaAttribute != $src->SchemaAttribute)
					return false;
				break;

			case XmlTypeCode::ProcessingInstruction:
				if ($this->TypeCode != XmlTypeCode::ProcessingInstruction)
					return false;
				break;

			case XmlTypeCode::Comment:
				if ( $this->TypeCode != XmlTypeCode::Comment )
					return false;
				break;

			case XmlTypeCode::Text:
				if ( $this->TypeCode != XmlTypeCode::Text )
					return false;
				break;
		}
		if ( ! is_null( $this->SchemaType ) || ! is_null( $src->SchemaType ) )
		{
			if ( ! is_null( $this->SchemaType ) && ! is_null( $src->SchemaType ) )
			{
				if ( ! DOMSchemaType::IsDerivedFrom( $this->SchemaType, $src->SchemaType, XmlSchemaDerivationMethod::Empty_ ) )
					return false;
			}
			else
				return false;
		}

		if ( $this->Cardinality != $src->Cardinality)
		{
			if ( ( $this->Cardinality == XmlTypeCardinality::ZeroOrOne || $this->Cardinality == XmlTypeCardinality::ZeroOrMore ) &&
				 ($src->Cardinality == XmlTypeCardinality::One || $src->Cardinality == XmlTypeCardinality::OneOrMore))
				return false;

			if ( $this->Cardinality == XmlTypeCardinality::One && $src->Cardinality == XmlTypeCardinality::OneOrMore)
				return false;
		}
		return true;
	}
338575
public function is_external_file( $file_url ) {

        // Set default return value.
        $is_external_file = false;

        // Parse url.
        $parsed_file_url = parse_url( $file_url );

        // Parse site url.
        $parsed_site_url = parse_url( site_url() );

        // Check if hosts don't match.
        if ( $parsed_file_url[ 'host' ] !== $parsed_site_url[ 'host' ] ) {

            // We now know the file is externally hosted.
            $is_external_file = true;

        }

        return $is_external_file;

    }
1196179
protected function copy($src, $dest)
    {
        if (!is_file($src) && !is_dir($src)) {
            return 'Source File or dir not found: ' . $src;
        }

        if (is_file($src)) {
            File::copy($src, $dest, true);
        } elseif (is_dir($src)) {
            Folder::copy($src, $dest, true);
        }

        return sprintf('Copy %s ===> %s', $src, $dest);
    }
966801
private function isRemoteImage(array $data)
    {
        return isset($data['image']['file']) && is_string($data['image']['file']) &&
            (!strncasecmp('http://', $data['image']['file'], 7) || !strncasecmp('https://', $data['image']['file'], 8));
    }
82634
static private function removeDirectory($src) 
	{
		$dir = opendir($src);
		while(false !== ( $file = readdir($dir)) ) {
			if ($file != '.' && $file != '..') {
				$full = $src . '/' . $file;

				if ( is_dir($full) ) {
					self::removeDirectory($full);
				} else {
					unlink($full);
    			}
			}
		}
		closedir($dir);
		rmdir($src);
	}
587821
protected function copy($src, $dest, &$errors = 0, &$success = 0)
    {
        if (is_file($src)) {

            if (copy($src, $dest)) {
                $success++;
                return true;
            }

            $errors++;
            return false;
        }

        if (!is_dir($dest) && !mkdir($dest)) {
            $errors++;
            return false;
        }

        foreach (new DirectoryIterator($src) as $file) {

            $result = null;
            $copyto = "$dest/" . $file->getBasename();

            if ($file->isFile() || (!$file->isDot() && $file->isDir())) {
                $result = $this->copy($file->getRealPath(), $copyto, $errors, $success);
            }

            if (!isset($result)) {
                continue;
            }

            if ($result) {
                $success++;
            } else {
                $errors++;
            }
        }

        $success++;
        return true;
    }
119337
public function is_file_readable_remotely_by_storedfile(stored_file $file) {
        if (!$file->get_filesize()) {
            // Files with empty size are either directories or empty.
            // We handle these virtually.
            return true;
        }

        $path = $this->get_remote_path_from_storedfile($file, false);
        if (is_readable($path)) {
            return true;
        }

        return false;
    }
1230075
protected function resourceExists($resource)
    {
        if (!$resource) {
            return false;
        }
        if ($resource instanceof ModuleResource) {
            return $resource->exists();
        }
        $base = rtrim(Director::baseFolder(), '/');
        return file_exists($base . '/' . $resource);
    }
153316
public static function removeDir($src)
    {

        // open the directory
        $dir = opendir($src);

        // remove files/folders recursively
        while (false !== ($file = readdir($dir))) {
            if (($file != '.') && ($file != '..')) {
                $full = $src . '/' . $file;
                if (is_dir($full)) {
                    FileSystem::removeDir($full);
                } else {
                    unlink($full);
                }
            }
        }

        // close handle and remove directory itself
        closedir($dir);
        rmdir($src);
    }