ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilBadgePictureDefinition Class Reference
+ Inheritance diagram for ilBadgePictureDefinition:
+ Collaboration diagram for ilBadgePictureDefinition:

Public Member Functions

array getId ()
 
 getFlavourMachineId ()
 Defines the ID of the machine that supports this definition. More...
 
 getInternalName ()
 This defines the speaky internal name of the definition, as the consumer would like to use it, e.g. More...
 
 getVariantName ()
 If a definition can be used in several variants (e.g. More...
 
 persist ()
 Define whether the generated flavor and the respective streams should be persisted, or whether they should only be generated and used in-memory. More...
 
 getQuality ()
 
 getWidths ()
 

Private Attributes

const ID = 'badge_image_resize_flavor'
 
int $quality = 50
 
array $widths
 

Detailed Description

Definition at line 23 of file class.ilBadgePictureDefinition.php.

Member Function Documentation

◆ getFlavourMachineId()

ilBadgePictureDefinition::getFlavourMachineId ( )

Defines the ID of the machine that supports this definition.

The machine MUST exist.

Implements ILIAS\ResourceStorage\Flavour\Definition\FlavourDefinition.

Definition at line 42 of file class.ilBadgePictureDefinition.php.

References ilBadgePictureMachine\ID.

42  : string
43  {
45  }

◆ getId()

array ilBadgePictureDefinition::getId ( )
Returns
string max. 64 characters, MUST be unique and NOT a class-related magic-constant. E.g. you can generate a random one with $ php -r"echo hash('sha256', uniqid());" | pbcopy in your shell and paste string in your getId() implementation.

If you ever change the ID, existing - maybe persisted - flavours created based on this definition will not be found anymore and have to be regenerated.

Implements ILIAS\ResourceStorage\Flavour\Definition\FlavourDefinition.

Definition at line 37 of file class.ilBadgePictureDefinition.php.

37  : string
38  {
39  return self::ID;
40  }

◆ getInternalName()

ilBadgePictureDefinition::getInternalName ( )

This defines the speaky internal name of the definition, as the consumer would like to use it, e.g.

to be able to distinguish between several flavors.

Implements ILIAS\ResourceStorage\Flavour\Definition\FlavourDefinition.

Definition at line 47 of file class.ilBadgePictureDefinition.php.

47  : string
48  {
49  return 'badge_picture';
50  }

◆ getQuality()

ilBadgePictureDefinition::getQuality ( )

Definition at line 65 of file class.ilBadgePictureDefinition.php.

References $quality.

65  : int
66  {
67  return $this->quality;
68  }

◆ getVariantName()

ilBadgePictureDefinition::getVariantName ( )

If a definition can be used in several variants (e.g.

configurable size of a thumbnail), such variants must be distinguishable. For example, a variant name may contain "{height}x{width}" if these are configurable values.

The Variant-Name MUST be less than 768 characters long!

Implements ILIAS\ResourceStorage\Flavour\Definition\FlavourDefinition.

Definition at line 52 of file class.ilBadgePictureDefinition.php.

52  : ?string
53  {
54  return json_encode([
55  'quality' => $this->quality,
56  'sizes' => $this->widths
57  ], JSON_THROW_ON_ERROR);
58  }

◆ getWidths()

ilBadgePictureDefinition::getWidths ( )
Returns
array{"xl": int, "l": int, "m": int, "s": int, "xs": int}

Definition at line 73 of file class.ilBadgePictureDefinition.php.

References $widths.

73  : array
74  {
75  return $this->widths;
76  }

◆ persist()

ilBadgePictureDefinition::persist ( )

Define whether the generated flavor and the respective streams should be persisted, or whether they should only be generated and used in-memory.

Implements ILIAS\ResourceStorage\Flavour\Definition\FlavourDefinition.

Definition at line 60 of file class.ilBadgePictureDefinition.php.

60  : bool
61  {
62  return true;
63  }

Field Documentation

◆ $quality

int ilBadgePictureDefinition::$quality = 50
private

Definition at line 27 of file class.ilBadgePictureDefinition.php.

Referenced by getQuality().

◆ $widths

array ilBadgePictureDefinition::$widths
private
Initial value:
= [
'xl' => 1920

Definition at line 29 of file class.ilBadgePictureDefinition.php.

Referenced by getWidths().

◆ ID

const ilBadgePictureDefinition::ID = 'badge_image_resize_flavor'
private

Definition at line 25 of file class.ilBadgePictureDefinition.php.


The documentation for this class was generated from the following file: