API / Minn\Media / Writer

Writer final readonly class

Minn\Media\Writer · public/minn/src/Minn/Media/Writer.php · 24 lines

Where the media library's files live, as a REST upload names them: a stored file's address, its path on disk, and its path relative to the uploads folder. The attachment itself is written through the runtime (wp_handle_upload, wp_insert_attachment, wp_generate_attachment_metadata), as the reference writes it.

Uses 1

Constants and properties

privatereadonly Minn\Media\Uploads $uploads

Promoted from the constructor.

Public

new__construct(Minn\Media\Uploads $uploads)#
methodurlOf(string $relative): string#

A stored file's address.

methodpathOf(string $relative): string#

A stored file's path on disk.

methodrelativeOf(string $absolutePath): ?string#

A stored file's path relative to the uploads folder, or null for one outside it.