Files
image/Image.class.php

58 lines
1.1 KiB
PHP
Raw Normal View History

2013-05-24 13:27:47 +04:00
<?php
class Image extends File
2013-05-24 13:27:47 +04:00
{
public $width;
public $height;
public $type;
public $size;
2013-05-24 13:27:47 +04:00
public $original_filename;
public $variants = array();
protected static $max_width;
protected static $max_height;
protected static $sizes = array();
2013-05-24 13:27:47 +04:00
/**
* @param $class string|StdClass
* @throws ErrorException
2013-05-24 13:27:47 +04:00
*/
public static function checkSubClass($class)
2013-05-24 13:27:47 +04:00
{
if (!self::getIsSubClass($class)) {
throw new ErrorException('Class "' . $class . '" mast be extend of "Image".');
2013-05-24 13:27:47 +04:00
}
}
/**
* @param $class string|StdClass
* @return bool
*/
public static function getIsSubClass($class)
{
return (get_parent_class($class) == __CLASS__);
}
public static function getSizes()
{
return static::$sizes;
2013-05-24 13:27:47 +04:00
}
public static function getMaxWidth()
{
return static::$max_width;
}
public static function getMaxHeight()
{
return static::$max_height;
}
public function getVariant($size)
{
return parent::getImageVariant($size);
}
2013-05-24 13:27:47 +04:00
}