Classes/Controller/ConfigurationController.php
protected function persistConfiguration(array $config) : bool
    {
        $configurationFileName = PATH_site . 'typo3conf/image_autoresize.config.php';

        $exportConfig = var_export($config, true);
        $exportConfig = str_replace('array (', '[', $exportConfig);
        if (substr($exportConfig, -1) === ')') {
            $exportConfig = substr($exportConfig, 0, strlen($exportConfig) - 1) . ']';
        }
        $exportConfig = preg_replace('/=>\\s*[[]/s', '=> [', $exportConfig);
        $lines = explode(LF, $exportConfig);
        foreach ($lines as $i => $line) {
            if (preg_match('/^(\\s+)(.+)$/', $line, $matches)) {
                if ($matches[2] === '),') {
                    // Convert ending of former array declaration to new syntax
                    $matches[2] = '],';
                }
                $lines[$i] = str_repeat(' ', 2 * strlen($matches[1])) . $matches[2];
            }
        }
        $exportConfig = implode(LF, $lines);

        $content = '<?' . 'php' . LF . 'return ' . $exportConfig . ';' . LF;
        $success = GeneralUtility::writeFile($configurationFileName, $content);
        return true;
    }
protected function persistConfiguration(array $config) : bool
    {
        $configurationFileName = PATH_site . 'typo3conf/image_autoresize.config.php';

        $exportConfig = var_export($config, true);
        $exportConfig = str_replace('array (', '[', $exportConfig);
        if (substr($exportConfig, -1) === ')') {
            $exportConfig = substr($exportConfig, 0, strlen($exportConfig) - 1) . ']';
        }
        $exportConfig = preg_replace('/=>\\s*[[]/s', '=> [', $exportConfig);
        $lines = explode(LF, $exportConfig);
        foreach ($lines as $i => $line) {
            if (preg_match('/^(\\s+)(.+)$/', $line, $matches)) {
                if ($matches[2] === '),') {
                    // Convert ending of former array declaration to new syntax
                    $matches[2] = '],';
                }
                $lines[$i] = str_repeat(' ', 2 * strlen($matches[1])) . $matches[2];
            }
        }
        $exportConfig = implode(LF, $lines);

        $content = '<?' . 'php' . LF . 'return ' . $exportConfig . ';' . LF;
        $success = GeneralUtility::writeFile($configurationFileName, $content);
        return true;
    }
protected function persistConfiguration ( array $ config ) : bool { $ configurationFileName = PATH_site . 'typo3conf/image_autoresize.config.php' ; $ exportConfig = var_export ( $ config , true ) ; $ exportConfig = str_replace ( 'array (' , '[' , $ exportConfig ) ; if ( substr ( $ exportConfig , - 1 ) === ')' ) { $ exportConfig = substr ( $ exportConfig , 0 , strlen ( $ exportConfig ) - 1 ) . ']' ; } $ exportConfig = preg_replace ( '/=>\\s*[[]/s' , '=> [' , $ exportConfig ) ; $ lines = explode ( LF , $ exportConfig ) ; foreach ( $ lines as $ i => $ line ) { if ( preg_match ( '/^(\\s+)(.+)$/' , $ line , $ matches ) ) { if ( $ matches [ 2 ] === '),' ) { // Convert ending of former array declaration to new syntax $ matches [ 2 ] = '],' ; } $ lines [ $ i ] = str_repeat ( ' ' , 2 * strlen ( $ matches [ 1 ] ) ) . $ matches [ 2 ] ; } } $ exportConfig = implode ( LF , $ lines ) ; $ content = '<?' . 'php' . LF . 'return ' . $ exportConfig . ';' . LF ; $ success = GeneralUtility :: writeFile ( $ configurationFileName , $ content ) ; return true ; }
Writes configuration to typo3conf/image_autoresize.config.php.

@param array $config
@return bool
Writes configuration to typo3conf / image_autoresize . config . php .