19 declare(strict_types=1);
38 public const ID =
'badge_image_resize_machine';
65 return ImagickEngine::class;
74 $this->definition = $for_definition;
77 $page_stream = $this->extract_pages->processStream(
82 $this->definition->getWidths()[
'xl'],
87 )->current()?->getStream();
89 if ($page_stream ===
null) {
94 foreach ($for_definition->getWidths() as $width) {
109 $quality = $size <= self::FULL_QUALITY_SIZE_THRESHOLD
111 : $this->definition->getQuality();
114 return $this->crop->processStream(
122 )->current()->getStream();
cropImage(FileStream $stream, int $size)
FileInformation $information
ilBadgePictureDefinition $definition
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct()
FlavourMachines must be able to be created without further dependencies.
dependsOnEngine()
Return the class name of the Engine that is required for this Machine to work.
const FULL_QUALITY_SIZE_THRESHOLD
processStream(FileInformation $information, FileStream $stream, FlavourDefinition $for_definition)
ExtractPages $extract_pages
trait GdImageToStreamTrait
__construct(Container $dic, ilPlugin $plugin)
canHandleDefinition(FlavourDefinition $definition)
Check if a corresponding configuration can be processed by this Machine.
The base interface for all filesystem streams.