API Documentation

MediaFile extends ProjectFile
in package

File abstraction for a project media file.

Table of Contents

Constants

EXTENSIONS  = ['png', 'svg', 'jpg', 'jpeg', 'webp', 'gif', 'ico', 'css', 'js']

Properties

$path  : string

Methods

__construct()  : mixed
all()  : array<string, MediaFile>
arraySerialize()  : array<string|int, mixed>
Recursively serialize Arrayables
files()  : array<string|int, string>
getAbsolutePath()  : string
getContentLength()  : int
getContents()  : string
getExtension()  : string
getIdentifier()  : string
getMimeType()  : string
getName()  : string
getPath()  : string
jsonSerialize()  : array<string|int, mixed>
make()  : static
toArray()  : array{name: string, path: string}
Get the instance as an array.
toJson()  : string
automaticallySerialize()  : array<string|int, mixed>
Automatically serialize all public properties.
discoverMediaAssetFiles()  : array<string|int, mixed>
getMediaAssetFiles()  : array<string|int, string>
getMediaFileExtensions()  : array<string|int, string>|string

Constants

EXTENSIONS

public final array<string|int, string> EXTENSIONS = ['png', 'svg', 'jpg', 'jpeg', 'webp', 'gif', 'ico', 'css', 'js']

The default extensions for media types

Properties

$path read-only

public string $path

The path relative to the project root.

Tags
example

_pages/index.blade.php

example

_media/logo.png

Methods

__construct()

public __construct(string $path) : mixed
Parameters
$path : string

all()

public static all() : array<string, MediaFile>
Return values
array<string, MediaFile>

The array keys are the filenames relative to the _media/ directory

arraySerialize()

Recursively serialize Arrayables

public arraySerialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

files()

public static files() : array<string|int, string>
Return values
array<string|int, string>

Array of filenames relative to the _media/ directory

getAbsolutePath()

public getAbsolutePath() : string
Return values
string

getContentLength()

public getContentLength() : int
Return values
int

getContents()

public getContents() : string
Return values
string

getExtension()

public getExtension() : string
Return values
string

getIdentifier()

public getIdentifier() : string
Return values
string

getMimeType()

public getMimeType() : string
Return values
string

getName()

public getName() : string
Return values
string

getPath()

public getPath() : string
Return values
string

jsonSerialize()

public jsonSerialize() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

make()

public static make(string $path) : static
Parameters
$path : string
Return values
static

toArray()

Get the instance as an array.

public toArray() : array{name: string, path: string}
Return values
array{name: string, path: string}

toJson()

public toJson([int $options = 0 ]) : string
Parameters
$options : int = 0
Return values
string

automaticallySerialize()

Automatically serialize all public properties.

protected automaticallySerialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

discoverMediaAssetFiles()

protected static discoverMediaAssetFiles() : array<string|int, mixed>
Return values
array<string|int, mixed>

getMediaAssetFiles()

protected static getMediaAssetFiles() : array<string|int, string>
Return values
array<string|int, string>

getMediaFileExtensions()

protected static getMediaFileExtensions() : array<string|int, string>|string
Return values
array<string|int, string>|string

        
On this page

Search results