ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilBadgePictureMachine Class Reference
+ Inheritance diagram for ilBadgePictureMachine:
+ Collaboration diagram for ilBadgePictureMachine:

Public Member Functions

 __construct ()
 FlavourMachines must be able to be created without further dependencies. More...
 
 getId ()
 
 canHandleDefinition (FlavourDefinition $definition)
 Check if a corresponding configuration can be processed by this Machine. More...
 
 dependsOnEngine ()
 Return the class name of the Engine that is required for this Machine to work. More...
 
- Public Member Functions inherited from ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\AbstractMachine
 __construct ()
 FlavourMachines must be able to be created without further dependencies. More...
 
 withEngine (Engine $engine)
 The demanded Engine will be passed here. More...
 
 getEngine ()
 
- Public Member Functions inherited from ILIAS\ResourceStorage\Flavour\Machine\FlavourMachine
 processStream (FileInformation $information, FileStream $stream, FlavourDefinition $for_definition)
 

Data Fields

const ID = 'badge_image_resize_machine'
 

Protected Member Functions

 cropImage (FileStream $stream, int $size)
 

Private Attributes

const FULL_QUALITY_SIZE_THRESHOLD = 100
 
CropSquare $crop
 
ilBadgePictureDefinition $definition = null
 
FileInformation $information = null
 
ExtractPages $extract_pages
 

Additional Inherited Members

- Protected Attributes inherited from ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\AbstractMachine
Engine $engine = null
 

Detailed Description

Definition at line 34 of file class.ilBadgePictureMachine.php.

Constructor & Destructor Documentation

◆ __construct()

ilBadgePictureMachine::__construct ( )

FlavourMachines must be able to be created without further dependencies.

Implements ILIAS\ResourceStorage\Flavour\Machine\FlavourMachine.

Definition at line 46 of file class.ilBadgePictureMachine.php.

References ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ canHandleDefinition()

ilBadgePictureMachine::canHandleDefinition ( FlavourDefinition  $definition)

Check if a corresponding configuration can be processed by this Machine.

Implements ILIAS\ResourceStorage\Flavour\Machine\FlavourMachine.

Definition at line 58 of file class.ilBadgePictureMachine.php.

58  : bool
59  {
60  return $definition instanceof ilBadgePictureDefinition;
61  }

◆ cropImage()

ilBadgePictureMachine::cropImage ( FileStream  $stream,
int  $size 
)
protected

Definition at line 105 of file class.ilBadgePictureMachine.php.

Referenced by dependsOnEngine().

108  : ?Stream {
109  $quality = $size <= self::FULL_QUALITY_SIZE_THRESHOLD
110  ? 100
111  : $this->definition->getQuality();
112 
113 
114  return $this->crop->processStream(
115  $this->information,
116  $stream,
117  new CropToSquare(
118  false,
119  $size,
120  $quality
121  )
122  )->current()->getStream();
123  }
+ Here is the caller graph for this function:

◆ dependsOnEngine()

ilBadgePictureMachine::dependsOnEngine ( )

Return the class name of the Engine that is required for this Machine to work.

Returning null will result in a NullEngine passed to the Machine.

Implements ILIAS\ResourceStorage\Flavour\Machine\FlavourMachine.

Definition at line 63 of file class.ilBadgePictureMachine.php.

References $information, cropImage(), null, and ILIAS\ResourceStorage\Flavour\Machine\FlavourMachine\processStream().

63  : ?string
64  {
65  return ImagickEngine::class;
66  }
+ Here is the call graph for this function:

◆ getId()

ilBadgePictureMachine::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, FlavourDefinitions may no longer process anything with your machine that previously designated you as the processing machine.

Implements ILIAS\ResourceStorage\Flavour\Machine\FlavourMachine.

Definition at line 53 of file class.ilBadgePictureMachine.php.

53  : string
54  {
55  return self::ID;
56  }

Field Documentation

◆ $crop

CropSquare ilBadgePictureMachine::$crop
private

Definition at line 41 of file class.ilBadgePictureMachine.php.

◆ $definition

ilBadgePictureDefinition ilBadgePictureMachine::$definition = null
private

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

◆ $extract_pages

ExtractPages ilBadgePictureMachine::$extract_pages
private

Definition at line 44 of file class.ilBadgePictureMachine.php.

◆ $information

FileInformation ilBadgePictureMachine::$information = null
private

Definition at line 43 of file class.ilBadgePictureMachine.php.

Referenced by dependsOnEngine().

◆ FULL_QUALITY_SIZE_THRESHOLD

const ilBadgePictureMachine::FULL_QUALITY_SIZE_THRESHOLD = 100
private

Definition at line 39 of file class.ilBadgePictureMachine.php.

◆ ID

const ilBadgePictureMachine::ID = 'badge_image_resize_machine'

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