ILIAS  release_8 Revision v8.24
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
 

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 
)

Member Function Documentation

◆ deleteByFilename()

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

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

121 : void
122 {
123 $this->repo->deleteImageByFilename($this->style_id, $filename);
124 }
$filename
Definition: buildRTE.php:78

References $filename.

◆ getByFilename()

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

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

76 : Image
77 {
78 return $this->repo->getByFilename($this->style_id, $filename);
79 }

References $filename.

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

+ Here is the caller graph for this function:

◆ getImages()

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

Get images of style.

Returns
Generator
Exceptions
Filesystem

Exception\DirectoryNotFoundException

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

53 : Generator
54 {
55 return $this->repo->getImages($this->style_id);
56 }

◆ getWebPath()

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

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

70 : string
71 {
72 return $this->repo->getWebPath($image->getPath());
73 }

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

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

+ 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 82 of file class.ImageManager.php.

87 : void {
88 if ($this->filenameExists($filename)) {
89 $file = $this->getWebPath($this->getByFilename($filename));
91 $file,
92 $file,
93 $width,
94 $height,
95 $constrain_proportions
96 );
97 }
98 }
static resizeImage(string $a_from, string $a_to, int $a_width, int $a_height, bool $a_constrain_prop=false)
resize image

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

+ Here is the call graph for this function:

◆ supportsResize()

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

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

103 : bool {
104 // for svg, see
105 // https://stackoverflow.com/questions/6532261/how-do-you-get-the-width-and-height-of-an-svg-picture-in-php
106 if (in_array(
107 strtolower(pathinfo($image->getFilename(), PATHINFO_EXTENSION)),
108 ["jpg", "jpeg", "gif", "png"]
109 )) {
110 return true;
111 }
112 return false;
113 }

◆ uploadImage()

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

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

116 : void
117 {
118 $this->repo->uploadImage($this->style_id);
119 }

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().

◆ $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: