3 declare(strict_types=1);
84 if ($this->
getImageMaterial()->getImagetype() && !$this->questionFilesService->isAllowedImageMimeType($this->getImageMaterial()->getImagetype())) {
88 if (!$this->questionFilesService->isAllowedImageMimeType($this->getDetectedMimeType())) {
93 $declaredMimeType = current(explode(
';', $this->
getImageMaterial()->getImagetype()));
96 if ($declaredMimeType != $detectedMimeType) {
103 'QPL: imported image with declared mime (' . $declaredMimeType .
') ' 104 .
'and detected mime (' . $detectedMimeType .
')' 124 return $this->questionFilesService->isAllowedImageFileExtension($this->
getDetectedMimeType(), $extension);
131 $label = basename($label);
140 $finfo =
new finfo(FILEINFO_MIME);
142 return $finfo->buffer($content);
147 $pathInfo = pathinfo($label);
149 if (isset($pathInfo[
'extension'])) {
150 return $pathInfo[
'extension'];
158 $pathInfo = pathinfo($label);
160 return array_key_exists(
'extension', $pathInfo);
Class ChatMainBarProvider .
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
hasFileExtension(string $label)
ILIAS TestQuestionPool QuestionFilesService $questionFilesService
setImageMaterial(ilQTIMatimage $imageMaterial)
static getASCIIFilename(string $a_filename)
determineFileExtension(string $label)
setDetectedMimeType(string $detectedMimeType)
ilQTIMatimage $imageMaterial
__construct(ilQTIMatimage $imageMaterial, \ILIAS\TestQuestionPool\QuestionFilesService $questionFilesService)
determineMimeType(?string $content)