Tiger_Media_Storage_Filesystem
@apiΒ· implementsTiger_Media_Storage_Interface
Tiger_Media_Storage_Filesystem β local-disk media storage.
Two roots (both resolved relative to APPLICATION_ROOT so config stays portable):
- PUBLIC files under the docroot (
public_root, e.g. public/_media) β served directly atpublic_urlwith no PHP in the path. - PRIVATE files OUTSIDE the docroot (
private_root, e.g. storage/media) β not web-reachable; url() returns '' so the media layer streams them through the ACL-checked /media/file/route.
Keys are relative paths; the adapter refuses .. traversal.
Methods
__construct()
__construct(array $config)
Resolve the public/private roots and public URL base from the disk config.
$configarrayβ themedia.disks.<name>.*settings
put()
put($key, $sourcePath, $visibility, $mime = null)
Store bytes from a source file path (copies the file to its target).
$keystringβ the adapter-relative storage key$sourcePathstringβ the source file on disk to copy from$visibilitystringβ public|private$mime?stringβ the content MIME type (unused by this adapter)
Throws RuntimeException β when the target can't be written
write()
write($key, $bytes, $visibility, $mime = null)
Store raw bytes to the target file.
$keystringβ the adapter-relative storage key$bytesstringβ the raw bytes to store$visibilitystringβ public|private$mime?stringβ the content MIME type (unused by this adapter)
Throws RuntimeException β when the target can't be written
get()
get($key, $visibility)
Read all bytes of a file.
$keystringβ the adapter-relative storage key$visibilitystringβ public|private
Returns string β the file's bytes
Throws RuntimeException β when the file is not found
stream()
stream($key, $visibility)
Open a read stream for a file.
$keystringβ the adapter-relative storage key$visibilitystringβ public|private
Returns resource β a readable file handle
Throws RuntimeException β when the file is not found
delete()
delete($key, $visibility)
Remove a file (idempotent β a missing file is not an error).
$keystringβ the adapter-relative storage key$visibilitystringβ public|private
exists()
exists($key, $visibility)
Does the file exist?
$keystringβ the adapter-relative storage key$visibilitystringβ public|private
Returns bool β true when the file exists
size()
size($key, $visibility)
Size of a file in bytes (0 if missing).
$keystringβ the adapter-relative storage key$visibilitystringβ public|private
Returns int β the file size in bytes, or 0 if missing
url()
url($key, $visibility, $ttl = null)
A directly-usable URL for a file (a docroot URL for public; '' for private).
$keystringβ the adapter-relative storage key$visibilitystringβ public|private$ttl?intβ unused by this adapter (no signed URLs)
Returns string β a public URL, or '' when the app must stream the bytes itself