class MediaPaths

Class MediaPaths abstracts away paths that we can use and also has a few helper methods for other classes to use

Methods

__construct(string $basepath = null, string $baseurl = null, null $Config = null)

Create a new Media Path Helper the purpose of this class is to determine paths for media (and versions of media)

string
basePath()

Gets the basepath for us

boolean
fileExists($mediapath)

Check to see if a file exists or not

touch($mediapath)

Create an empty file in this location

fileVersionInfoFromUrl($url)

Gets the versioned path to this $url path

fileVersionInfo($filePath)

Gets the versioned path to this file

string
makeRelativePath($path)

Make this path relative to public directory

string
zencoderUrl($filename)

Returns the zencoder url for this filename

string
downloadFromUrl($path, $newFilePath = null)

Downloads the image so that we can re-use it later and crop it and resize it accordingly

boolean
isUrlPath($url)

Returns true or false depending on if this is an image url or not

Details

at line 24
__construct(string $basepath = null, string $baseurl = null, null $Config = null)

Create a new Media Path Helper the purpose of this class is to determine paths for media (and versions of media)

Parameters

string $basepath
string $baseurl
null $Config

at line 36
string basePath()

Gets the basepath for us

Return Value

string

at line 47
boolean fileExists($mediapath)

Check to see if a file exists or not

Parameters

$mediapath

Return Value

boolean

at line 56
touch($mediapath)

Create an empty file in this location

Parameters

$mediapath

at line 74
stdClass fileVersionInfoFromUrl($url)

Gets the versioned path to this $url path

Parameters

$url

Return Value

stdClass

at line 108
stdClass fileVersionInfo($filePath)

Gets the versioned path to this file

Parameters

$filePath

Return Value

stdClass

Exceptions

InvalidFileException

at line 169
string makeRelativePath($path)

Make this path relative to public directory

Parameters

$path

Return Value

string

at line 180
string zencoderUrl($filename)

Returns the zencoder url for this filename

Parameters

$filename

Return Value

string

at line 198
string downloadFromUrl($path, $newFilePath = null)

Downloads the image so that we can re-use it later and crop it and resize it accordingly

Parameters

$path
$newFilePath

Return Value

string

at line 233
boolean isUrlPath($url)

Returns true or false depending on if this is an image url or not

Parameters

$url

Return Value

boolean