20 declare(strict_types=1);
49 return $this->image_material;
54 $this->image_material = $image_material;
82 if ($this->
getImageMaterial()->getImagetype() && !$this->question_files->isAllowedImageMimeType($this->getImageMaterial()->getImagetype())) {
86 if (!$this->question_files->isAllowedImageMimeType($this->getDetectedMimeType())) {
91 $declaredMimeType = current(explode(
';', $this->
getImageMaterial()->getImagetype()));
94 if ($declaredMimeType != $detectedMimeType) {
101 'QPL: imported image with declared mime (' . $declaredMimeType .
') ' 102 .
'and detected mime (' . $detectedMimeType .
')' 122 return $this->question_files->isAllowedImageFileExtension($this->
getDetectedMimeType(), $extension);
129 $label = basename($label);
138 $finfo =
new finfo(FILEINFO_MIME);
140 return $finfo->buffer($content);
145 $pathInfo = pathinfo($label);
147 if (isset($pathInfo[
'extension'])) {
148 return $pathInfo[
'extension'];
156 $pathInfo = pathinfo($label);
158 return array_key_exists(
'extension', $pathInfo);
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
hasFileExtension(string $label)
__construct(protected ilQTIMatimage $image_material, private QuestionFiles $question_files)
setImageMaterial(ilQTIMatimage $image_material)
static getASCIIFilename(string $a_filename)
determineFileExtension(string $label)
setDetectedMimeType(string $detectedMimeType)
determineMimeType(?string $content)