Create media object.

@param string $path path of media

@return MediaInterface
542796
public function create($path = null)
    {
        $media = new $this->class();

        if ($path !== null) {
            $media->setFile(new \Symfony\Component\HttpFoundation\File\File($path));
        }

        return $media;
    }
1159492
public static function getFromFile($path)
    {
        if (!($path instanceof File))
            $path = new File($path);

        $ext = $path->getExtension();
        $path = $path->getFullPath();

        $type = new FileType($ext ?? "", "");
        if (empty($type->getMimeType()) && file_exists($path))
            $type->setMimeType(mime_content_type($path));

        return $type;
    }
1056275
public function createFromExistingPath(string $path): File
    {
        $file = new File($path);
        if (false === $file->exists()) {
            throw new DoctrineStaticMetaException('File does not exist at ' . $path);
        }

        return $file;
    }
370075
public function getFile($path)
    {
        $file = new File($this->getFileSystemId(), $this->getFullPath($path));
        $file->setServiceLocator($this->getServiceLocator());
        return $file;
    }
278870
public function get(string $path): File {
		return (new File(Paths::appendPath($this->getUrl(), $path)))->addFilters($this->recursiveFilter, true);
	}
244366
public function makeFolder($path)
    {
        $path = self::validatePath($path);
        $fullPath = $this->getMediaPath($path);

        return $this->getStorageDisk()->makeDirectory($fullPath);
    }
140422
public static function create($path)
    {
        $file = new static($path);

        if (! is_dir(dirname($path))) {
            mkdir(dirname($path), 0755, true);
        }

        if (! $file->exists()) {
            touch($path);
        }

        return $file;
    }
931459
public function withPath(string $path): UriInterface
    {
        $instance = clone $this;
        $instance->path = $this->marshalPath($path);

        return $instance;
    }
49365
public static function createFromPath(string $path)
    {
        $createFunctions = [
            'image/png' => 'imagecreatefrompng',
            'image/jpeg' => 'imagecreatefromjpeg',
            'image/gif' => 'imagecreatefromgif',
        ];

        $mimeType = mime_content_type($path);

        if (!array_key_exists($mimeType, $createFunctions)) {
            throw new InvalidMimeTypeException(sprintf('The "%s" mime type is not supported.', $mimeType));
        }

        $resource = $createFunctions[$mimeType]($path);

        return new static($resource);
    }
791284
private function createFromPng(string $path): self
    {
        $imageData = imagecreatefrompng($path);
        if (false === $imageData) {
            throw new ImageException(sprintf('Unable to create PNG image from %s!', $path));
        }
        $this->workingData = $imageData;
        $this->setTransparency(false, true);
        $this->encrypted = false;
        return $this;
    }
78051
public function createResource($path)
    {
        $response = $this->httpRequest($path, Requests::POST, $this);

        return $this->populate($response);
    }
1015606
public function create( $path = '' )
    {
        $this->sessionPath = $path;

        if ( file_exists( $path ) )
        {
            $this->getFileContents();
        }
        else
        {
            $this->items = [ ];
        }
    }
85671
public static function create(string $path): self
    {
        if (!is_dir($path)) {
            if (is_writeable(dirname($path))) {
                if (mkdir($path)) {
                    return new static($path);
                }
                throw new FolderException('Creating folder ('.$path.') failed');
            }
            throw new FolderException('Cannot create folder, because the directory ('.dirname($path).') is not accessible',
                FolderException::NOT_WRITEABLE);
        }
        throw new FolderException('Cannot create folder, because the folder path ('.$path.') already exists', FolderException::ALREADY_EXIST);
    }
1295261
public static function createResource($path, $object)
    {
        if (is_array($object)) {
            $object = (object)$object;
        }

        return self::connection()->post(self::$api_path . $path, $object);
    }
1284178
public function load(string $path): FileSettingsProvider
    {
        foreach ($this->selectClasses($path, SettingsInterface::class) as $settingsClass) {
            assert($this->checkDoNotHaveRequiredParametersOnCreate($settingsClass));
            /** @var SettingsInterface $settings */
            $settings = new $settingsClass();
            $this->register($settings);
        }

        return $this;
    }
1354205
public function create($path)
    {
        $drive = null;
        $isAbsolute = false;
        $isAnchored = false;
        $hasTrailingSeparator = false;

        if ('' === $path) {
            $atoms = array(AbstractPath::SELF_ATOM);
        } else {
            $atoms = preg_split('{[/\\\\]}', $path);
        }

        if (preg_match('{^([a-zA-Z]):}', $atoms[0], $matches)) {
            $drive = $matches[1];

            $atoms[0] = substr($atoms[0], 2);
            if (false === $atoms[0]) {
                $atoms[0] = '';
            }
        }

        $numAtoms = count($atoms);

        if ($numAtoms > 1) {
            if ('' === $atoms[0]) {
                if (null === $drive) {
                    $isAnchored = true;
                } else {
                    $isAbsolute = true;
                }

                array_shift($atoms);
                --$numAtoms;
            }
        } else {
            $isAbsolute = null !== $drive && '' === $atoms[0];
        }

        if ($numAtoms > 1) {
            if ('' === $atoms[$numAtoms - 1]) {
                $hasTrailingSeparator = true;
                array_pop($atoms);
            }
        }

        return $this->createFromDriveAndAtoms(
            array_filter($atoms, 'strlen'),
            $drive,
            $isAbsolute,
            $isAnchored,
            $hasTrailingSeparator
        );
    }
159362
public function path($path)
    {
        $path = trim($path);

        if (str_empty($this->fileName)) {
            $this->fileName(basename($path));
        }

        if (str_empty($this->fileType)) {
            $this->fileType(mime_content_type($path));
        }

        $this->fileContent(fopen($path, 'r'));

        return $this;
    }