SilverStripe\Assets\Storage\AssetContainer
Represents a container for a specific asset.
This is used as a use-agnostic interface to a single asset backed by an AssetStore
Note that there are no setter equivalents for each of getHash, getVariant and getFilename.
User code should utilise the setFrom* methods instead.
Synopsis
interface AssetContainer
{
- // methods
- public array setFromString()
- public array setFromLocalFile()
- public array setFromStream()
- public string getString()
- public resource getStream()
- public string getURL()
- public string getAbsoluteURL()
- public array|null getMetaData()
- public string getMimeType()
- public int getAbsoluteSize()
- public bool getIsImage()
- public string getVisibility()
- public bool exists()
- public string getFilename()
- public string getHash()
- public string getVariant()
- public bool deleteFile()
- public string renameFile()
- public string copyFile()
- public void publishFile()
- public void protectFile()
- public void grantFile()
- public void revokeFile()
- public bool canViewFile()
Methods
public
- canViewFile() — Check if the current user can view the given file.
- copyFile() — Copy to new filename.
- deleteFile() — Delete a file (and all variants).
- exists() — Determine if this container has a valid value
- getAbsoluteSize() — Return file size in bytes.
- getAbsoluteURL()
- getFilename() — Get value of filename
- getHash() — Get value of hash
- getIsImage() — Determine if a valid non-empty image exists behind this asset
- getMetaData() — Get metadata for this file
- getMimeType() — Get mime type
- getStream()
- getString()
- getURL()
- getVariant() — Get value of variant
- getVisibility() — Determine visibility of the given file
- grantFile() — Ensures that access to the specified protected file is granted for the current user.
- protectFile() — Protect a file (and all variants) from public access, identified by the given filename and hash.
- publishFile() — Publicly expose the file (and all variants) identified by the given filename and hash {@see AssetStore::publish}
- renameFile() — Rename to new filename, and point to new file
- revokeFile() — Revoke access to the given file for the current user.
- setFromLocalFile() — Assign a local file to the backend.
- setFromStream() — Assign a stream to the backend
- setFromString() — Assign a set of data to the backend