ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilImageMagickRenderer.php
Go to the documentation of this file.
1 <?php
27 {
28  // constants
29  private const SUPPORTED_FORMATS = "jpg,jpeg,jp2,png,gif,bmp,tif,tiff,cur,ico,pict,tga,psd";
30 
31  // variables
32  private static ?array $supported_formats = null;
33 
39  public function getSupportedFileFormats(): array
40  {
41  // build formats only once
42  if (!isset(self::$supported_formats)) {
43  self::$supported_formats = self::evaluateSupportedFileFormats();
44  }
45 
46  return self::$supported_formats;
47  }
48 
54  public static function evaluateSupportedFileFormats(): array
55  {
56  return explode(",", self::SUPPORTED_FORMATS) ?? [];
57  }
58 
66  protected function renderImages(\ilObject $obj): array
67  {
68  $filepath = $obj->getFile();
69  $tmpPath = $this->prepareFileForExec($filepath);
70  $isTemporary = $tmpPath !== $filepath;
71  return array(new ilRenderedImage($tmpPath, $isTemporary));
72  }
73 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getSupportedFileFormats()
Gets an array containing the file formats that are supported by the renderer.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
prepareFileForExec(string $filepath)
Checks whether the specified file path can be used with exec() commands.
static evaluateSupportedFileFormats()
Evaluates the supported file formats.
renderImages(\ilObject $obj)
Renders the specified object into images.