19 declare(strict_types=1);
26 'image/jpeg' => array(
'jpg',
'jpeg'),
27 'image/png' => array(
'png'),
28 'image/gif' => array(
'gif')
36 $extensions = array();
38 foreach (self::$allowedImageMaterialFileExtensionsByMimeType as $mimeType => $mimeExtensions) {
40 $extensions = array_merge($extensions, $mimeExtensions);
42 return array_unique($extensions);
50 self::IMG_MIME_TYPE_JPG => array(
'jpg',
'jpeg'),
51 self::IMG_MIME_TYPE_PNG => array(
'png'),
52 self::IMG_MIME_TYPE_GIF => array(
'gif')
56 self::IMG_MIME_TYPE_JPG => array(
'binary'),
57 self::IMG_MIME_TYPE_PNG => array(
'binary'),
58 self::IMG_MIME_TYPE_GIF => array(
'binary')
63 foreach (self::$allowedFileExtensionsByMimeType as $allowedMimeType => $extensions) {
64 $rexCharsets = implode(
'|', self::$allowedCharsetsByMimeType[$allowedMimeType]);
65 $rexMimeType = preg_quote($allowedMimeType,
'/');
67 $rex =
'/^' . $rexMimeType .
'(;(\s)*charset=(' . $rexCharsets .
'))*$/';
69 if (!preg_match($rex, $mimeType)) {
91 return CLIENT_WEB_DIR .
'/assessment/' . $parentObjectId .
'/' . $questionId .
'/images/';
static getAllowedImageMaterialFileExtensions()
getAllowedFileExtensionsForMimeType(string $mimeType)
static array $allowedCharsetsByMimeType
isAllowedImageFileExtension(string $mimeType, string $fileExtension)
isAllowedImageMimeType($mimeType)
static array $allowedImageMaterialFileExtensionsByMimeType
static array $allowedFileExtensionsByMimeType
buildImagePath($questionId, $parentObjectId)