ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilCertificateBackgroundImageFileService Class Reference
+ Collaboration diagram for ilCertificateBackgroundImageFileService:

Public Member Functions

 __construct (private readonly string $certificatePath, private readonly Filesystem $fileSystem, private readonly string $webDirectory=CLIENT_WEB_DIR)
 
 hasBackgroundImage (ilCertificateTemplate $template)
 
 getBackgroundImageThumbPath ()
 
 getBackgroundImageDirectory (string $backgroundImagePath='')
 
 getBackgroundImageTempfilePath (string $extension)
 
 getValidBackgroundImageFileExtensions ()
 

Data Fields

final const BACKGROUND_IMAGE_NAME = 'background.jpg'
 
final const BACKGROUND_TEMPORARY_UPLOAD_FILE_NAME = 'background_upload_tmp'
 
final const BACKGROUND_THUMBNAIL_FILE_ENDING = '.thumb.jpg'
 
final const PLACEHOLDER_CLIENT_WEB_DIRECTORY = '[CLIENT_WEB_DIR]'
 
final const VALID_BACKGROUND_IMAGE_EXTENSIONS = ['jpg', 'jpeg', 'gif', 'png']
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCertificateBackgroundImageFileService::__construct ( private readonly string  $certificatePath,
private readonly Filesystem  $fileSystem,
private readonly string  $webDirectory = CLIENT_WEB_DIR 
)

Definition at line 34 of file ilCertificateBackgroundImageFileService.php.

38  {
39  }

Member Function Documentation

◆ getBackgroundImageDirectory()

ilCertificateBackgroundImageFileService::getBackgroundImageDirectory ( string  $backgroundImagePath = '')

Definition at line 56 of file ilCertificateBackgroundImageFileService.php.

56  : string
57  {
58  return str_replace(
59  [$this->webDirectory, '//'],
60  [self::PLACEHOLDER_CLIENT_WEB_DIRECTORY, '/'],
61  $backgroundImagePath
62  );
63  }

◆ getBackgroundImageTempfilePath()

ilCertificateBackgroundImageFileService::getBackgroundImageTempfilePath ( string  $extension)

Definition at line 65 of file ilCertificateBackgroundImageFileService.php.

65  : string
66  {
67  return implode('', [
68  $this->webDirectory,
69  $this->certificatePath,
70  self::BACKGROUND_TEMPORARY_UPLOAD_FILE_NAME,
71  '.' . $extension
72  ]);
73  }

◆ getBackgroundImageThumbPath()

ilCertificateBackgroundImageFileService::getBackgroundImageThumbPath ( )

Definition at line 51 of file ilCertificateBackgroundImageFileService.php.

51  : string
52  {
53  return $this->webDirectory . $this->certificatePath . self::BACKGROUND_IMAGE_NAME . self::BACKGROUND_THUMBNAIL_FILE_ENDING;
54  }

◆ getValidBackgroundImageFileExtensions()

ilCertificateBackgroundImageFileService::getValidBackgroundImageFileExtensions ( )
Returns
list<string>

Definition at line 78 of file ilCertificateBackgroundImageFileService.php.

78  : array
79  {
80  return self::VALID_BACKGROUND_IMAGE_EXTENSIONS;
81  }

◆ hasBackgroundImage()

ilCertificateBackgroundImageFileService::hasBackgroundImage ( ilCertificateTemplate  $template)

Definition at line 41 of file ilCertificateBackgroundImageFileService.php.

References ilCertificateTemplate\getBackgroundImagePath().

41  : bool
42  {
43  $backgroundImagePath = $template->getBackgroundImagePath();
44  if ($backgroundImagePath === '') {
45  return false;
46  }
47 
48  return $this->fileSystem->has($backgroundImagePath);
49  }
+ Here is the call graph for this function:

Field Documentation

◆ BACKGROUND_IMAGE_NAME

final const ilCertificateBackgroundImageFileService::BACKGROUND_IMAGE_NAME = 'background.jpg'

Definition at line 28 of file ilCertificateBackgroundImageFileService.php.

◆ BACKGROUND_TEMPORARY_UPLOAD_FILE_NAME

final const ilCertificateBackgroundImageFileService::BACKGROUND_TEMPORARY_UPLOAD_FILE_NAME = 'background_upload_tmp'

◆ BACKGROUND_THUMBNAIL_FILE_ENDING

final const ilCertificateBackgroundImageFileService::BACKGROUND_THUMBNAIL_FILE_ENDING = '.thumb.jpg'

◆ PLACEHOLDER_CLIENT_WEB_DIRECTORY

final const ilCertificateBackgroundImageFileService::PLACEHOLDER_CLIENT_WEB_DIRECTORY = '[CLIENT_WEB_DIR]'

Definition at line 31 of file ilCertificateBackgroundImageFileService.php.

◆ VALID_BACKGROUND_IMAGE_EXTENSIONS

final const ilCertificateBackgroundImageFileService::VALID_BACKGROUND_IMAGE_EXTENSIONS = ['jpg', 'jpeg', 'gif', 'png']

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