Media\Classes\MediaLibraryItem
Overview
MediaLibraryItem represents a file or folder in the Media Library.
Public Properties
public string $title
title specifies the item title.
public string $path
path specifies the item path relative to the Library root.
public integer $size
size specifies the item size. For files the item size is measured in bytes. For folders it contains the number of files in the folder.
public integer $lastModified
lastModified contains the last modification time (Unix timestamp).
public string $type
type specifies the item type.
public string $publicUrl
publicUrl specifies the public URL of the item.
Protected Properties
protected static array $imageExtensions
imageExtensions contains a default list of image files and directories to ignore. Override with config: media.image_extensions
protected static array $videoExtensions
videoExtensions contains a default list of video files and directories to ignore. Override with config: media.video_extensions
protected static array $audioExtensions
audioExtensions contains a default list of audio files and directories to ignore. Override with config: media.audio_extensions
Public Methods
public __construct()
public __construct(
string $path,
int $size,
int $lastModified,
string $type,
string $publicUrl
): void
__construct a library item
public static forgetExtensions()
public static forgetExtensions(): void
forgetExtensions resets extensions supplied by config but stored in RAM
public getFileType()
public getFileType(): string
getFileType returns the file type by its name. Returns the file type or NULL if the item is a folder. The known file types are: image, video, audio, document
public isFile()
public isFile(): bool
public lastModifiedAsString()
public lastModifiedAsString(): string
lastModifiedAsString returns the item last modification date as string.
public sizeToString()
public sizeToString(): string
sizeToString returns the item size as string. For file-type items the size is the number of bytes. For folder-type items the size is the number of items contained by the item.