19 declare(strict_types=1);
34 private \ILIAS\Filesystem\Util\Archive\Archives
$archives;
40 $this->image_converter = $DIC->fileConverters()->images();
41 $this->archives = $DIC->archives();
42 $this->delivery = $DIC->fileDelivery();
64 $converter = $this->image_converter->convertToFormat(
65 Streams::ofResource(fopen($from,
'rb')),
66 ImageOutputOptions::FORMAT_JPG,
67 $geometry ===
'' ? null : (
int) $geometry,
68 $geometry ===
'' ? null : (
int) $geometry,
72 if (!$converter->isOK()) {
75 'Could not convert image %s to %s',
80 $converter->getThrowableIfAny()
84 $stream = $converter->getStream();
88 if (file_put_contents($to, $stream->getContents()) ===
false) {
91 'Could not store converted image %s to %s',
110 public function zipAndDeliver(array $streams,
string $download_filename): void
112 $this->delivery->delivery()->attached(
113 $this->archives->zip($streams)->get(),
118 public function getDir(
string $copyDirectory): array
123 public function unzip(
string $file,
string $zip_output_path,
bool $overwrite):
Unzip 125 return $this->archives->unzip(
126 Streams::ofResource(fopen($file,
'rb')),
127 $this->archives->unzipOptions()
128 ->withOverwrite($overwrite)
129 ->withZipOutputPath($zip_output_path)
130 ->withDirectoryHandling(ZipDirectoryHandling::KEEP_STRUCTURE)
146 bool $raise_errors =
true,
147 string $mode =
'move_uploaded' 160 string $module_path =
"",
161 string $mode =
"output",
162 bool $offline =
false
convertImage(string $from, string $to, string $geometry='')
zipAndDeliver(array $streams, string $download_filename)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
prepareFormOutput(string $string)
stripSlashes(string $string)
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
moveUploadedFile(string $file, string $name, string $target, bool $raise_errors=true, string $mode='move_uploaded')
ILIAS FileDelivery Services $delivery
ILIAS Filesystem Util Convert Images $image_converter
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getDir(string $a_dir, bool $a_rec=false, ?string $a_sub_dir="")
get directory
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
deliverData(string $data, string $fileName, string $mimeType)
unzip(string $file, string $zip_output_path, bool $overwrite)
Just a wrapper class to create Unit Test for other classes.
ILIAS Filesystem Util Archive Archives $archives
getDir(string $copyDirectory)