AssetContainer
interface 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.
Methods
Assign a set of data to the backend
Assign a local file to the backend.
Assign a stream to the backend
No description
No description
No description
No description
Get metadata for this file
Get mime type
Return file size in bytes.
Determine if a valid non-empty image exists behind this asset
Determine visibility of the given file
Determine if this container has a valid value
Get value of filename
Get value of hash
Get value of variant
Delete a file (and all variants).
Rename to new filename, and point to new file
Copy to new filename.
Publicly expose the file (and all variants) identified by the given filename and hash {see AssetStore::publish}
Protect a file (and all variants) from public access, identified by the given filename and hash.
Ensures that access to the specified protected file is granted for the current user.
Revoke access to the given file for the current user.
Check if the current user can view the given file.
Details
at line 27
array
setFromString(string $data, string $filename, string $hash = null, string $variant = null, array $config = array())
Assign a set of data to the backend
at line 41
array
setFromLocalFile(string $path, string $filename = null, string $hash = null, string $variant = null, array $config = array())
Assign a local file to the backend.
at line 54
array
setFromStream(resource $stream, string $filename, string $hash = null, string $variant = null, array $config = array())
Assign a stream to the backend
at line 59
string
getString()
at line 64
resource
getStream()
at line 74
string
getURL(bool $grant = true)
at line 79
string
getAbsoluteURL()
at line 86
array|null
getMetaData()
Get metadata for this file
at line 93
string
getMimeType()
Get mime type
at line 100
int
getAbsoluteSize()
Return file size in bytes.
at line 107
bool
getIsImage()
Determine if a valid non-empty image exists behind this asset
at line 115
string
getVisibility()
Determine visibility of the given file
at line 122
bool
exists()
Determine if this container has a valid value
at line 129
string
getFilename()
Get value of filename
at line 136
string
getHash()
Get value of hash
at line 143
string
getVariant()
Get value of variant
at line 151
bool
deleteFile()
Delete a file (and all variants).
{see AssetStore::delete()}
at line 159
string
renameFile(string $newName)
Rename to new filename, and point to new file
at line 168
string
copyFile(string $newName)
Copy to new filename.
This will not automatically point to the new file (as renameFile() does)
at line 174
publishFile()
Publicly expose the file (and all variants) identified by the given filename and hash {see AssetStore::publish}
at line 180
protectFile()
Protect a file (and all variants) from public access, identified by the given filename and hash.
{see AssetStore::protect()}
at line 190
grantFile()
Ensures that access to the specified protected file is granted for the current user.
If this file is currently in protected mode, the asset store will ensure the returned asset for the duration of the current session / user. This will have no effect if the file is in published mode. This will not grant access to users other than the owner of the current session. Does not require a member to be logged in.
at line 196
revokeFile()
Revoke access to the given file for the current user.
Note: This will have no effect if the given file is public
at line 203
bool
canViewFile()
Check if the current user can view the given file.