Created
September 6, 2026 10:02
-
-
Save iamrobert/fbba95b3ab0fe2e7cded6303cb40a548 to your computer and use it in GitHub Desktop.
Replace components\com_flexicontent\librairies\phpthumb\phpThumb.config_OVERRIDE.php with
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // THIS FILES IS NOT OVERWRITTEN BY FLEXICONTENT | |
| // PLEASE ADD YOUR CUSTOM CONFIGURATION STRINGS HERE | |
| // * DocumentRoot configuration | |
| // phpThumb() depends on $_SERVER['DOCUMENT_ROOT'] to resolve path/filenames. This value is usually correct, | |
| // but has been known to be broken on some servers. This value allows you to override the default value. | |
| // Do not modify from the auto-detect default value unless you are having problems. | |
| // $PHPTHUMB_CONFIG['document_root'] = ...; | |
| // * Security baseline | |
| // Keep these settings in the override file so FLEXIcontent/phpThumb updates do not reset them. | |
| // phpThumb 1.7.21 cannot enforce HTTPS-only remote sources or reject private network | |
| // destinations through configuration alone. Redirects stay disabled until destination | |
| // validation is implemented in the remote URL downloader. | |
| $PHPTHUMB_CONFIG['disable_debug'] = true; // Do not expose filesystem paths or diagnostic information. | |
| $PHPTHUMB_CONFIG['allow_src_above_docroot'] = false; // Local source files must remain inside the website document root. | |
| $PHPTHUMB_CONFIG['nohotlink_enabled'] = true; // Restrict remote sources to the domains configured below. | |
| // phpThumb.php runs without loading Joomla, so derive the site hostname from the | |
| // web server configuration. Do not use HTTP_HOST because a client can supply it. | |
| $phpThumbServerName = trim((string) ($_SERVER['SERVER_NAME'] ?? '')); | |
| $phpThumbServerHost = strtolower(rtrim((string) parse_url('http://' . $phpThumbServerName, PHP_URL_HOST), '.')); | |
| $PHPTHUMB_CONFIG['nohotlink_valid_domains'] = array(); | |
| if ($phpThumbServerHost !== '' && filter_var($phpThumbServerHost, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) { | |
| $PHPTHUMB_CONFIG['nohotlink_valid_domains'][] = $phpThumbServerHost; | |
| $PHPTHUMB_CONFIG['nohotlink_valid_domains'][] = strpos($phpThumbServerHost, 'www.') === 0 | |
| ? substr($phpThumbServerHost, 4) | |
| : 'www.' . $phpThumbServerHost; | |
| $PHPTHUMB_CONFIG['nohotlink_valid_domains'] = array_values(array_unique(array_filter($PHPTHUMB_CONFIG['nohotlink_valid_domains']))); | |
| } | |
| unset($phpThumbServerName, $phpThumbServerHost); | |
| $PHPTHUMB_CONFIG['http_follow_redirect'] = false; // Do not follow an allowed URL to an unvalidated destination. | |
| $PHPTHUMB_CONFIG['allow_local_http_src'] = false; // Use /images/file.jpg for local files; reject same-host http:// URLs. | |
| $PHPTHUMB_CONFIG['cache_maxage'] = 86400 * 90; // delete cached thumbnails that haven't been accessed in more than [90 days] (value is maximum time since last access in seconds to avoid deletion) | |
| //2gb | |
| $PHPTHUMB_CONFIG['cache_maxsize'] = 2000 * 1024 * 1024; | |
| $PHPTHUMB_CONFIG['cache_maxfiles'] = 100000; | |
| // delete least-recently-accessed cached thumbnails when more than [100000] cached files are present (value is maximum number of cached files to keep) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment