Devise
Class

Devise\Media\MediaPaths

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 $mediapath)

Check to see if a file exists or not

touch($mediapath $mediapath)

Create an empty file in this location

stdClass fileVersionInfoFromUrl($url $url)

Gets the versioned path to this $url path

stdClass fileVersionInfo($filePath $filePath)

Gets the versioned path to this file

string makeRelativePath($path $path)

Make this path relative to public directory

string zencoderUrl($filename $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 $url)

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

Details

at line 22
public __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 34
public string basePath()

Gets the basepath for us

Return Value

string

at line 45
public boolean fileExists($mediapath $mediapath)

Check to see if a file exists or not

Parameters

$mediapath $mediapath

Return Value

boolean

at line 54
public touch($mediapath $mediapath)

Create an empty file in this location

Parameters

$mediapath $mediapath

at line 72
public stdClass fileVersionInfoFromUrl($url $url)

Gets the versioned path to this $url path

Parameters

$url $url

Return Value

stdClass

at line 103
public stdClass fileVersionInfo($filePath $filePath)

Gets the versioned path to this file

Parameters

$filePath $filePath

Return Value

stdClass

Exceptions

InvalidFileException

at line 161
public string makeRelativePath($path $path)

Make this path relative to public directory

Parameters

$path $path

Return Value

string

at line 172
public string zencoderUrl($filename $filename)

Returns the zencoder url for this filename

Parameters

$filename $filename

Return Value

string

at line 190
public 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 225
public boolean isUrlPath($url $url)

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

Parameters

$url $url

Return Value

boolean