You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.1 KiB
58 lines
1.1 KiB
<?php
|
|
|
|
class Image extends File
|
|
{
|
|
public $width;
|
|
public $height;
|
|
public $type;
|
|
public $size;
|
|
|
|
public $original_filename;
|
|
public $variants = array();
|
|
|
|
protected static $max_width;
|
|
|
|
protected static $max_height;
|
|
|
|
protected static $sizes = array();
|
|
|
|
/**
|
|
* @param $class string|StdClass
|
|
* @throws ErrorException
|
|
*/
|
|
public static function checkSubClass($class)
|
|
{
|
|
if (!self::getIsSubClass($class)) {
|
|
throw new ErrorException('Class "' . $class . '" mast be extend of "Image".');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param $class string|StdClass
|
|
* @return bool
|
|
*/
|
|
public static function getIsSubClass($class)
|
|
{
|
|
return (get_parent_class($class) == __CLASS__);
|
|
}
|
|
|
|
public static function getSizes()
|
|
{
|
|
return static::$sizes;
|
|
}
|
|
|
|
public static function getMaxWidth()
|
|
{
|
|
return static::$max_width;
|
|
}
|
|
|
|
public static function getMaxHeight()
|
|
{
|
|
return static::$max_height;
|
|
}
|
|
|
|
public function getVariant($size)
|
|
{
|
|
return parent::getImageVariant($size);
|
|
}
|
|
}
|