| CARVIEW |
Every repository with this icon (
Every repository with this icon (
| Description: | CakePHP plugin enabling transfer/manipulation/embedding of (media) files in 2300 ways. |
Medium Helper
Setup
Just include the helper in your helpers property or see the manual on using helpers
class ExamplesController extends AppController {
var $helpers = array('Form', 'Html', 'Media.Medium');
}
Settings can be specified – if needed – like this
class ExamplesController extends AppController {
var $helpers = array('Form', 'Html', 'Media.Medium' => array('versions' => array('xxxxl','l')));
}
Usage
The helper is designed to embed/access files stored in a conventionalized media directory layout (see Configuration) easily and to centralize all media file handling. The contents of the MEDIA constant are used as the base directory. Below you’ll find the main helper methods as well as a brief description and corresponding examples.
::file($path)
Resolves a fragmented path to an absolute path to an existing file.
Given files and directory layout:
your-media-root/
- static
- img
- test.jpg
...
- transfer
- vid
- mymovie.avi
...
- filter
- s
- static
- img
- test.png
- transfer
- vid
- mymovie.png
...
- xl
- static
- img
- test.png
| Path | Finds |
| img/test | static/img/test.jpg |
| static/img/test.jpg | static/img/test.jpg |
| transfer/vid/mymovie | transfer/vid/mymovie.avi |
| s/img/test | filter/s/static/img/test.png |
| s/transfer/vid/mymovie | filter/s/transfer/vid/mymovie.png |
| css/backend | static/css/backend.css |
::embed($path, $options = array())
Generates HTML to embed a file specifed as a fragmented path (see ::file). Currently supports images and video and flash.
::link($path, $options = array())
Links to a file specified as a fragmented path or an URL. Currently supports javascript, css and rss.
::mimeType($path)
Returns the MIME type of a file specified as a fragmented path.
::size($path)
Returns the size of a file specified as a fragmented path.








