Tiger_Media_Storage_Interface
@api
Tiger_Media_Storage_Interface β the pluggable storage backend for media bytes.
The media table holds metadata; the actual bytes live behind one of these adapters
(filesystem / S3 / GCS / Azure), selected per-file by the row's disk. visibility
(public|private) is passed to every locating call because it can change WHERE/HOW a
backend stores or serves an object (a filesystem adapter keeps public files under the
docroot and private files outside it; S3 sets the object ACL). Keys are adapter-relative,
tenant-namespaced paths built by the upload service β <org_id>/<kind-folder>/<rand>.<ext>
(e.g. 3f2504e0-β¦/images/ab12β¦.jpg); the adapter prepends the visibility root
(public/ | private/). The immutable <org_id> segment keeps tenants' bytes separated.
Methods
put()
put($key, $sourcePath, $visibility, $mime = null)
Store bytes from a source file path (e.g. an upload tmp file).
$keystringβ the adapter-relative storage key$sourcePathstringβ the source file on disk to copy from$visibilitystringβ public|private$mime?stringβ the content MIME type (may be null)
write()
write($key, $bytes, $visibility, $mime = null)
Store raw bytes (e.g. a generated thumbnail held in memory).
$keystringβ the adapter-relative storage key$bytesstringβ the raw bytes to store$visibilitystringβ public|private$mime?stringβ the content MIME type (may be null)
get()
get($key, $visibility)
Read all bytes.
$keystringβ the adapter-relative storage key$visibilitystringβ public|private
Returns string β the object's bytes
stream()
stream($key, $visibility)
Open a read stream (for large files β avoids loading them fully into memory).
$keystringβ the adapter-relative storage key$visibilitystringβ public|private
Returns resource β a readable stream for the object
delete()
delete($key, $visibility)
Remove the object (idempotent β missing is not an error).
$keystringβ the adapter-relative storage key$visibilitystringβ public|private
exists()
exists($key, $visibility)
Does the object exist?
$keystringβ the adapter-relative storage key$visibilitystringβ public|private
Returns bool β true when the object exists
size()
size($key, $visibility)
Size in bytes (0 if missing).
$keystringβ the adapter-relative storage key$visibilitystringβ public|private
Returns int β the object size in bytes, or 0 if missing
url()
url($key, $visibility, $ttl = null)
A directly-usable URL, or '' when the caller must serve it itself. Public objects always yield a URL (direct path / CDN); private objects yield a signed URL when the backend supports one (S3 presign), else '' β the media layer then serves it through the ACL-checked streamer route (/media/file/
$keystringβ the adapter-relative storage key$visibilitystringβ public|private$ttlint|nullβ seconds for a signed URL (backend default when null)
Returns string β a usable URL, or '' when the caller must serve the bytes itself