ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\Style\Content\ImageManager Class Reference

Main business logic for content style images. More...

+ Collaboration diagram for ILIAS\Style\Content\ImageManager:

Public Member Functions

 __construct (int $style_id, Access\StyleAccessManager $access_manager, ImageFileRepo $repo)
 
 getImages ()
 Get images of style. More...
 
 getWebPath (Image $image)
 
 getByFilename (string $filename)
 
 resizeImage (string $filename, int $width, int $height, bool $constrain_proportions)
 
 supportsResize (Image $image)
 
 uploadImage ()
 
 deleteByFilename (string $filename)
 

Protected Attributes

ImageFileRepo $repo
 
Access StyleAccessManager $access_manager
 
int $style_id
 

Private Attributes

Filesystem Util Convert LegacyImages $image_conversion
 

Detailed Description

Main business logic for content style images.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 32 of file class.ImageManager.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Style\Content\ImageManager::__construct ( int  $style_id,
Access\StyleAccessManager  $access_manager,
ImageFileRepo  $repo 
)

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

References ILIAS\Style\Content\ImageManager\$access_manager, $DIC, ILIAS\Style\Content\ImageManager\$repo, and ILIAS\Style\Content\ImageManager\$style_id.

43  {
44  global $DIC;
45  $this->repo = $repo;
46  $this->access_manager = $access_manager;
47  $this->style_id = $style_id;
48  $this->image_conversion = $DIC->fileConverters()->legacyImages();
49  }
global $DIC
Definition: feed.php:28
Access StyleAccessManager $access_manager

Member Function Documentation

◆ deleteByFilename()

ILIAS\Style\Content\ImageManager::deleteByFilename ( string  $filename)

Definition at line 125 of file class.ImageManager.php.

125  : void
126  {
127  $this->repo->deleteImageByFilename($this->style_id, $filename);
128  }
$filename
Definition: buildRTE.php:78

◆ getByFilename()

ILIAS\Style\Content\ImageManager::getByFilename ( string  $filename)

Definition at line 79 of file class.ImageManager.php.

Referenced by ILIAS\Style\Content\ImageManager\resizeImage().

79  : Image
80  {
81  return $this->repo->getByFilename($this->style_id, $filename);
82  }
$filename
Definition: buildRTE.php:78
+ Here is the caller graph for this function:

◆ getImages()

ILIAS\Style\Content\ImageManager::getImages ( )

Get images of style.

Returns
Generator
Exceptions
Filesystem

Definition at line 56 of file class.ImageManager.php.

References $filename.

56  : Generator
57  {
58  return $this->repo->getImages($this->style_id);
59  }

◆ getWebPath()

ILIAS\Style\Content\ImageManager::getWebPath ( Image  $image)

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

References ILIAS\Style\Content\Image\getPath().

Referenced by ILIAS\Style\Content\ImageManager\resizeImage().

73  : string
74  {
75  return $this->repo->getWebPath($image->getPath());
76  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resizeImage()

ILIAS\Style\Content\ImageManager::resizeImage ( string  $filename,
int  $width,
int  $height,
bool  $constrain_proportions 
)

Definition at line 85 of file class.ImageManager.php.

References ILIAS\Style\Content\ImageManager\getByFilename(), and ILIAS\Style\Content\ImageManager\getWebPath().

90  : void {
91  if ($this->filenameExists($filename)) {
92  $file = $this->getWebPath($this->getByFilename($filename));
93 
94  $this->image_conversion->resizeToFixedSize(
95  $file,
96  $file,
97  $width,
98  $height,
99  $constrain_proportions
100  );
101  }
102  }
$filename
Definition: buildRTE.php:78
+ Here is the call graph for this function:

◆ supportsResize()

ILIAS\Style\Content\ImageManager::supportsResize ( Image  $image)

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

References ILIAS\Style\Content\Image\getFilename().

107  : bool {
108  // for svg, see
109  // https://stackoverflow.com/questions/6532261/how-do-you-get-the-width-and-height-of-an-svg-picture-in-php
110  if (in_array(
111  strtolower(pathinfo($image->getFilename(), PATHINFO_EXTENSION)),
112  ["jpg", "jpeg", "gif", "png"]
113  )) {
114  return true;
115  }
116  return false;
117  }
+ Here is the call graph for this function:

◆ uploadImage()

ILIAS\Style\Content\ImageManager::uploadImage ( )

Definition at line 120 of file class.ImageManager.php.

120  : void
121  {
122  $this->repo->uploadImage($this->style_id);
123  }

Field Documentation

◆ $access_manager

Access StyleAccessManager ILIAS\Style\Content\ImageManager::$access_manager
protected

Definition at line 35 of file class.ImageManager.php.

Referenced by ILIAS\Style\Content\ImageManager\__construct().

◆ $image_conversion

Filesystem Util Convert LegacyImages ILIAS\Style\Content\ImageManager::$image_conversion
private

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

◆ $repo

ImageFileRepo ILIAS\Style\Content\ImageManager::$repo
protected

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

Referenced by ILIAS\Style\Content\ImageManager\__construct().

◆ $style_id

int ILIAS\Style\Content\ImageManager::$style_id
protected

Definition at line 36 of file class.ImageManager.php.

Referenced by ILIAS\Style\Content\ImageManager\__construct().


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