AssetsHelper
- Type
- Class
- Namespace
- Craft
- Inherits
- Craft\AssetsHelper
- Since
- 1.0
Class AssetsHelper
See also http://craftcms.com
View source (opens new window)
# Public Methods
Method | Description |
---|---|
cleanAssetName() | Clean an Asset's filename. |
generateUrl() | Generate a URL for a given Assets file in a Source Type. |
getFilenameReplacement() | Return a filename replacement for a filename in a list of files. The file list typically represents a folder's contents. |
getTempFilePath() | Get a temporary file path. |
getUrlAppendix() | Get appendix for an URL based on it's Source caching settings. |
# cleanAssetName()
Clean an Asset's filename.
View source (opens new window)
Arguments
$name
$isFilename
(boolean (opens new window)) – If set to true (default), will separate extension and clean the filename separately.$preventPluginModifications
Returns
mixed
Signature
public static mixed cleanAssetName ( $name, $isFilename = true, $preventPluginModifications = false )
# generateUrl()
Generate a URL for a given Assets file in a Source Type.
View source (opens new window)
Arguments
$sourceType
(Craft\BaseAssetSourceType)$file
(Craft\AssetFileModel)
Returns
Signature
public static string generateUrl ( Craft\BaseAssetSourceType $sourceType, Craft\AssetFileModel $file )
# getFilenameReplacement()
Return a filename replacement for a filename in a list of files. The file list typically represents a folder's contents.
View source (opens new window)
Arguments
$fileList
(array (opens new window))$originalFilename
Returns
string (opens new window) – $filename
Throws
- Craft\Exception
When a replacement cannot be found.
Signature
public static string getFilenameReplacement ( array $fileList, $originalFilename )
# getTempFilePath()
Get a temporary file path.
View source (opens new window)
Arguments
$extension
(string (opens new window)) – Extension to use. "tmp" by default.$suppressErrors
(boolean (opens new window))
Returns
mixed
Throws
Signature
public static mixed getTempFilePath ( $extension = 'tmp', $suppressErrors = false )
# getUrlAppendix()
Get appendix for an URL based on it's Source caching settings.
View source (opens new window)
Arguments
$source
(Craft\BaseAssetSourceType)$file
(Craft\AssetFileModel)
Returns
Signature
public static string getUrlAppendix ( Craft\BaseAssetSourceType $source, Craft\AssetFileModel $file )
# Constants
Constant | Description |
---|---|
INDEX_SKIP_ITEMS_PATTERN |