Classes/Service/ImageResizer.php
protected function expandValuesInRuleset(array $ruleset)
    {
        $values = [];
        foreach ($ruleset as $key => $value) {
            switch ($key) {
                case 'usergroup':
                    $value = GeneralUtility::trimExplode(',', $value, true);
                    break;
                case 'directories':
                    $values['directories_config'] = '';
                    $value = GeneralUtility::trimExplode(',', $value, true);
                    // Sanitize name of the directories
                    foreach ($value as &$directory) {
                        $directory = rtrim($directory, '/') . '/';
                        if (!empty($values['directories_config'])) {
                            $values['directories_config'] .= ',';
                        }
                        $values['directories_config'] .= $directory;
                        $directory = $this->getDirectoryPattern($directory);
                    }
                    if (count($value) == 0) {
                        // Inherit configuration
                        $value = '';
                    }
                    break;
                case 'file_types':
                    $value = GeneralUtility::trimExplode(',', $value, true);
                    if (count($value) == 0) {
                        // Inherit configuration
                        $value = '';
                    }
                    break;
                case 'threshold':
                    if (!is_numeric($value)) {
                        $unit = strtoupper(substr($value, -1));
                        $factor = 1 * ($unit === 'K' ? 1024 : ($unit === 'M' ? 1024 * 1024 : 0));
                        $value = intval(trim(substr($value, 0, strlen($value) - 1))) * $factor;
                    }
                // Beware: fall-back to next value processing
                case 'max_width':
                case 'max_height':
                    if ($value <= 0) {
                        // Inherit configuration
                        $value = '';
                    }
                    break;
                case 'max_size':
                    if (!is_numeric($value)) {
                        $unit = strtoupper(substr($value, -1));
                        $factor = 1 * ($unit === 'M' ? 1000000 : 1);
                        $value = intval(trim(substr($value, 0, strlen($value) - 1))) * $factor;
                    }
                    break;
                case 'conversion_mapping':
                    if (strpos($value, CRLF) !== false) {
                        $mapping = GeneralUtility::trimExplode(CRLF, $value, true);
                    } else {
                        $mapping = GeneralUtility::trimExplode(',', $value, true);
                    }
                    if (count($mapping) > 0) {
                        $value = $this->expandConversionMapping($mapping);
                    } else {
                        // Inherit configuration
                        $value = '';
                    }
                    break;
            }
            $values[$key] = $value;
        }

        return $values;
    }
protected function expandValuesInRuleset(array $ruleset)
    {
        $values = [];
        foreach ($ruleset as $key => $value) {
            switch ($key) {
                case 'usergroup':
                    $value = GeneralUtility::trimExplode(',', $value, true);
                    break;
                case 'directories':
                    $values['directories_config'] = '';
                    $value = GeneralUtility::trimExplode(',', $value, true);
                    // Sanitize name of the directories
                    foreach ($value as &$directory) {
                        $directory = rtrim($directory, '/') . '/';
                        if (!empty($values['directories_config'])) {
                            $values['directories_config'] .= ',';
                        }
                        $values['directories_config'] .= $directory;
                        $directory = $this->getDirectoryPattern($directory);
                    }
                    if (count($value) == 0) {
                        // Inherit configuration
                        $value = '';
                    }
                    break;
                case 'file_types':
                    $value = GeneralUtility::trimExplode(',', $value, true);
                    if (count($value) == 0) {
                        // Inherit configuration
                        $value = '';
                    }
                    break;
                case 'threshold':
                    if (!is_numeric($value)) {
                        $unit = strtoupper(substr($value, -1));
                        $factor = 1 * ($unit === 'K' ? 1024 : ($unit === 'M' ? 1024 * 1024 : 0));
                        $value = intval(trim(substr($value, 0, strlen($value) - 1))) * $factor;
                    }
                // Beware: fall-back to next value processing
                case 'max_width':
                case 'max_height':
                    if ($value <= 0) {
                        // Inherit configuration
                        $value = '';
                    }
                    break;
                case 'max_size':
                    if (!is_numeric($value)) {
                        $unit = strtoupper(substr($value, -1));
                        $factor = 1 * ($unit === 'M' ? 1000000 : 1);
                        $value = intval(trim(substr($value, 0, strlen($value) - 1))) * $factor;
                    }
                    break;
                case 'conversion_mapping':
                    if (strpos($value, CRLF) !== false) {
                        $mapping = GeneralUtility::trimExplode(CRLF, $value, true);
                    } else {
                        $mapping = GeneralUtility::trimExplode(',', $value, true);
                    }
                    if (count($mapping) > 0) {
                        $value = $this->expandConversionMapping($mapping);
                    } else {
                        // Inherit configuration
                        $value = '';
                    }
                    break;
            }
            $values[$key] = $value;
        }

        return $values;
    }
Expands values of a rule set.

@param array $ruleset
@return array