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.
46 lines
998 B
46 lines
998 B
<?php
|
|
|
|
class Image extends File
|
|
{
|
|
public $width;
|
|
public $height;
|
|
public $type;
|
|
public $size;
|
|
|
|
public $original_filename;
|
|
public $variants = array();
|
|
|
|
protected static $sizes = array();
|
|
|
|
/**
|
|
* @param $class string
|
|
* @throws ErrorException
|
|
*/
|
|
public static function checkSubClass($class)
|
|
{
|
|
if (is_null($class) || $class == '') {
|
|
throw new ErrorException('Class not defined.');
|
|
}
|
|
if (!class_exists($class)) {
|
|
throw new ErrorException('Class "' . $class . '" not exists.');
|
|
}
|
|
if (get_parent_class($class) != 'Image') {
|
|
throw new ErrorException('Class "' . $class . '" mast be extend of "Image".');
|
|
}
|
|
}
|
|
|
|
public function getSizes()
|
|
{
|
|
return static::$sizes;
|
|
}
|
|
|
|
public function getVariant($size)
|
|
{
|
|
return parent::getImageVariant($size);
|
|
}
|
|
|
|
public function getIsNoEmpty()
|
|
{
|
|
return (bool) $this->size;
|
|
}
|
|
}
|