Example:
Media::attach('app', array(
'path' => '/var/www/website/app/webroot/extradir',
'prefix' => 'extradir'
));
Media::attach('cdn', array(
'absolute' => true,
'path' => null,
'host' => 'http://my.cdn.com',
'prefix' => 'project1/assets'
));
Media::attach('cdn', array(
'absolute' => true,
'path' => null,
'host' => array('my.cdn.com', 'secure.cdn.com'),
'scheme' => array('http://', 'https://'),
'prefix' => 'project1/assets',
));
Media::attach('cdn', array(
'absolute' => true,
'path' => null,
'host' => array('my1.cdn.com', 'my2.cdn.com'),
'scheme' => 'http://',
'prefix' => 'project1/assets',
));
public static attach ( string $name, array $config = null ) : void | ||
$name | string | The name of the media you wish to attach. |
$config | array | Asset configuration options for the given scope. - `'path'` _string_: Path of the media. - `'prefix'` _string_: Contains the uri prefix. Such as `css`. - `'absolute'` _boolean_: Defaults to `false`. If you want to generate absolute URL's. - `'host'` _mixed_: String host, or array of hosts, of the media, if absolute is `true`. - `'scheme'` _mixed_: String scheme, or array of sc, of the media, if absolute is `true`. |
return | void |