diff --git a/core/includes/file.inc b/core/includes/file.inc index 16ed619..a16a23d 100644 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@ -324,6 +324,19 @@ function file_default_scheme() { } /** + * Gets the file stream implementation for derived image style files. + * + * @param $original_scheme + * The file scheme of the original image, used as a default. + * + * @return + * 'public', 'private' or any other file scheme. + */ +function file_image_style_scheme($original_scheme = NULL) { + return variable_get('file_image_style_scheme', ($original_scheme) ? $original_scheme : file_default_scheme()); +} + +/** * Normalizes a URI by making it syntactically correct. * * A stream is referenced as "scheme://target". diff --git a/core/modules/image/image.module b/core/modules/image/image.module index 315f99a..10e2dcf 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -890,7 +890,8 @@ function image_style_path($style_name, $uri) { $path = $uri; $scheme = file_default_scheme(); } - return $scheme . '://styles/' . $style_name . '/' . $scheme . '/' . $path; + $image_style_scheme = file_image_style_scheme($scheme); + return $image_style_scheme . '://styles/' . $style_name . '/' . $scheme . '/' . $path; } /** diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index c55289c..9226162 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -1756,6 +1756,13 @@ function system_file_system_settings() { '#options' => $options, '#description' => t('This setting is used as the preferred download method. The use of public files is more efficient, but does not provide any access control.'), ); + $form['file_image_style_scheme'] = array( + '#type' => 'radios', + '#title' => t('Derived image download method'), + '#default_value' => variable_get('file_image_style_scheme', ''), + '#options' => array_merge(array('' => t('Same as original image')), $options), + '#description' => t('This setting is used for the location of images derived by image style presets.'), + ); } return system_settings_form($form);