Model_Media

class Nos\Media\Model_Media

Extends Nos\Orm\Model.

Relations

property Nos\Media\Model_Media::$folder

Behaviours

Methods

Nos\Media\Model_Media::delete_from_disk()
Returns:True or false depending on whether the deletion was successful.

Delete the original media file from the disk.

Nos\Media\Model_Media::delete_public_cache()
Returns:True or false depending on whether the deletion was successful.

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

Nos\Media\Model_Media::get_path()
Returns:Relative media file virtual path.
Nos\Media\Model_Media::get_public_path()
Returns:Public media file URL relative to base href.
Nos\Media\Model_Media::get_private_path()
Returns:Private media file path relative to Novius OS root directory.
Nos\Media\Model_Media::get_img_tag($params = array())
Parameters:
  • $params (array) –
    max_width:Max width of the image.
    max_height:Max height of the image.
Returns:

If the media file is an image, a HTML <img> tag with src, width and height attributes, depends of $params. False otherwise.

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

If the media file is an image, a HTML <img> tag with src, width and height attributes. False otherwise.

Alias of get_img_tag(array('width' => $max_width, 'height' => $max_height)).

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

If the media file is an image, an associative array with keys src, width and height depends of size parameters. False otherwise.

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

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

Nos\Media\Model_Media::is_image()
Returns:True or false, depend if media is an image.