ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilUserProfilePictureMachine Class Reference
+ Inheritance diagram for ilUserProfilePictureMachine:
+ Collaboration diagram for ilUserProfilePictureMachine:

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
 __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...
 
 withEngine (Engine $engine)
 The demanded Engine will be passed here. More...
 
 getEngine ()
 
 processStream (FileInformation $information, FileStream $stream, FlavourDefinition $for_definition)
 

Data Fields

const ID = "a3c77dec93b5303f4340767b9a445ad591f6025a9ca7edbf24fa8ab23a851eae"
 

Protected Member Functions

 cropImage (FileStream $stream, int $size)
 
 makeGreyScale (FileStream $stream)
 

Private Attributes

const FULL_QUALITY_SIZE_THRESHOLD = 100
 
CropSquare $crop
 
MakeGreyScale $grey
 
ilUserProfilePictureDefinition $definition = null
 
FileInformation $information = null
 

Additional Inherited Members

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilUserProfilePictureMachine::__construct ( )

FlavourMachines must be able to be created without further dependencies.

Reimplemented from ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\AbstractMachine.

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

Member Function Documentation

◆ canHandleDefinition()

ilUserProfilePictureMachine::canHandleDefinition ( FlavourDefinition  $definition)

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

Implements ILIAS\ResourceStorage\Flavour\Machine\FlavourMachine.

Definition at line 59 of file class.ilUserProfilePictureMachine.php.

References $definition.

◆ cropImage()

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

Definition at line 93 of file class.ilUserProfilePictureMachine.php.

96 : ?FileStream {
97 $quality = $size <= self::FULL_QUALITY_SIZE_THRESHOLD
98 ? 100 // we take 100% jpeg quality for small resultions
99 : $this->definition->getQuality();
100
101
102 return $this->crop->processStream(
103 $this->information,
104 $stream,
105 new CropToSquare(
106 false,
107 $size,
108 $quality
109 )
110 )->current()?->getStream();
111 }
The base interface for all filesystem streams.
Definition: FileStream.php:32

◆ dependsOnEngine()

ilUserProfilePictureMachine::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 64 of file class.ilUserProfilePictureMachine.php.

64 : ?string
65 {
66 return GDEngine::class;
67 }

◆ getId()

ilUserProfilePictureMachine::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 54 of file class.ilUserProfilePictureMachine.php.

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

References ID.

◆ makeGreyScale()

ilUserProfilePictureMachine::makeGreyScale ( FileStream  $stream)
protected

Definition at line 113 of file class.ilUserProfilePictureMachine.php.

115 : ?FileStream {
116 return $this->grey->processStream(
117 $this->information,
118 $stream,
119 new ToGreyScale(
120 false,
121 $this->definition->getQuality()
122 )
123 )->current()?->getStream();
124 }

Field Documentation

◆ $crop

CropSquare ilUserProfilePictureMachine::$crop
private

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

◆ $definition

ilUserProfilePictureDefinition ilUserProfilePictureMachine::$definition = null
private

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

Referenced by canHandleDefinition().

◆ $grey

MakeGreyScale ilUserProfilePictureMachine::$grey
private

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

◆ $information

FileInformation ilUserProfilePictureMachine::$information = null
private

Definition at line 45 of file class.ilUserProfilePictureMachine.php.

◆ FULL_QUALITY_SIZE_THRESHOLD

const ilUserProfilePictureMachine::FULL_QUALITY_SIZE_THRESHOLD = 100
private

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

◆ ID

const ilUserProfilePictureMachine::ID = "a3c77dec93b5303f4340767b9a445ad591f6025a9ca7edbf24fa8ab23a851eae"

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