3declare(strict_types=1);
35 protected const DIR_PATH =
"sty/sty_%id%/images";
52 protected function dir(
int $style_id): string
54 return str_replace(
"%id%", (
string) $style_id, self::DIR_PATH);
66 $dir = $this->
dir($style_id);
67 if ($this->web_files->hasDir($dir)) {
68 foreach ($this->web_files->listContents($dir) as $meta) {
69 if ($meta->isFile()) {
70 $size = $this->web_files->getSize(
74 $image_size = getimagesize($this->
getWebPath($meta->getPath()));
75 $width = $image_size[0] ?? 0;
76 $height = $image_size[1] ?? 0;
77 yield $this->factory->image(
95 public function getByFilename(
int $style_id,
string $filename): ?
Image
98 foreach ($this->getImages($style_id) as
$i) {
113 $upload = $this->upload;
114 $dir = $this->dir($style_id);
115 if (!$this->web_files->hasDir($dir)) {
116 $this->web_files->createDir($dir);
122 $result = array_values($upload->
getResults())[0];
132 $dir = $this->dir($style_id);
133 $this->web_files->delete($dir .
"/" .
$filename);
This class provides the data size with additional information to remove the work to calculate the siz...
Repository internal data service.
uploadImage(int $style_id)
InternalDataService $factory
getImages(int $style_id)
Get images of style.
__construct(InternalDataService $factory, Filesystem\Filesystem $web_files, FileUpload $upload)
deleteImageByFilename(int $style_id, string $filename)
Filesystem Filesystem $web_files
getResults()
Returns the results of the processing and moving operation of the uploaded files.
hasUploads()
Return (bool)true if one ore more file-uploads are in the current request, (bool)false if not.
process()
Invokes all preprocessors for each uploaded file in the sequence they got registered.
moveFilesTo(string $destination, int $location=Location::STORAGE)
Moves all uploaded files to the given destination after the processors had processed the files.
hasBeenProcessed()
Return (bool)true if the current upload has already been processed.
const WEB
The filesystem within the ilias web root.
Class FlySystemFileAccessTest \Provider\FlySystem @runTestsInSeparateProcesses @preserveGlobalState d...
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...