AssetsHelper

Type
Class
Namespace
Craft
Inherits
Craft\AssetsHelper
Since
1.0

Class AssetsHelper

See also http://craftcms.com

View source

Public Methods

MethodDescription
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

Arguments

  • $name
  • $isFilename (boolean) – 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

Arguments

Returns

string

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

Arguments

  • $fileList (array)
  • $originalFilename

Returns

string – $filename

Throws

Signature

public static string getFilenameReplacement ( array $fileList, $originalFilename )

getTempFilePath()

Get a temporary file path.

View source

Arguments

  • $extension (string) – Extension to use. "tmp" by default.
  • $suppressErrors (boolean)

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

Arguments

Returns

string

Signature

public static string getUrlAppendix ( Craft\BaseAssetSourceType $source, Craft\AssetFileModel $file )

Constants

ConstantDescription
INDEX_SKIP_ITEMS_PATTERN