Model_Media

class Nos\Media\Model_Media

Extends Nos\Orm\Model.

Relations

property Nos\Media\Model_Media::$folder

Behaviours

Methods

Nos\Media\Model_Media::deleteFromDisk()

Delete the original media file from the disk.

Nos\Media\Model_Media::deleteCache()

Delete all the cached versions (thumbnails) of the media files from the disk.

Nos\Media\Model_Media::path()
Returns:Private absolute media file path.
Nos\Media\Model_Media::htmlImg($params = array())
Parameters:
  • $params (array) – the attributes array
Returns:

If the media file is an image, return an html image tag of the media.

Sets width, height, alt attributes is not supplied.

Nos\Media\Model_Media::htmlImgResized($max_width = null, $max_height = null, $params = array())
Parameters:
  • $max_width (array) – Max width of the image.
  • $max_height (array) – Max height of the image.
  • $params (array) – the attributes array
Returns:

If the media file is an image, return an html image tag of the media resized.

Sets width, height, alt attributes is not supplied.

Nos\Media\Model_Media::htmlAnchor($attributes = array())
Parameters:
  • $attributes (array) –
    Array of attributes to be applied to the anchor tag.
    If key ‘text’ is set in $attributes parameter, its value replace media title
Returns:

Returns an HTML anchor tag with, by default, media URL in href and media title in text.

Nos\Media\Model_Media::url($absolute = true)
Parameters:
  • $absolute (bool) – Default true, if false return relative URL :returns: Public media file URL.
Nos\Media\Model_Media::urlResized($max_width = 0, $max_height = 0, $absolute = true)
Parameters:
  • $max_width (array) – Max width of the image.
  • $max_height (array) – Max height of the image.
  • $absolute (bool) – Default true, if false return relative URL
Returns:

If the media file is an image, media URL for specify size parameters. False otherwise.

Nos\Media\Model_Media::isImage()
Returns:True or false, depend if media is an image.
Nos\Media\Model_Media::getToolkitImage()
Returns:Returns a Nos\Toolkit_Image based on the media if is an image, False otherwise.