diff options
author | Marc Alexander <admin@m-a-styles.de> | 2018-11-11 12:22:20 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2018-11-11 12:22:20 +0100 |
commit | 7801bac09ac1fb5a10c0c518e1e7639233855220 (patch) | |
tree | ce042bf0f0d978e81a5f9473e2f42845bba6121f /phpBB/includes/functions_posting.php | |
parent | f4063e475dff62f68bdd4c813bf3450492abb3c1 (diff) | |
parent | 023ec01611123c426a5aeaf812e50fb1ade43c0e (diff) | |
download | forums-7801bac09ac1fb5a10c0c518e1e7639233855220.tar forums-7801bac09ac1fb5a10c0c518e1e7639233855220.tar.gz forums-7801bac09ac1fb5a10c0c518e1e7639233855220.tar.bz2 forums-7801bac09ac1fb5a10c0c518e1e7639233855220.tar.xz forums-7801bac09ac1fb5a10c0c518e1e7639233855220.zip |
Merge branch 'prep-release-3.2.4' into 3.2.x
Diffstat (limited to 'phpBB/includes/functions_posting.php')
-rw-r--r-- | phpBB/includes/functions_posting.php | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 1e8f1ad00d..c7d691287c 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -519,7 +519,7 @@ function get_supported_image_types($type = false) */ function create_thumbnail($source, $destination, $mimetype) { - global $config, $phpbb_filesystem; + global $config, $phpbb_filesystem, $phpbb_dispatcher; $min_filesize = (int) $config['img_min_thumb_filesize']; $img_filesize = (file_exists($source)) ? @filesize($source) : false; @@ -551,25 +551,31 @@ function create_thumbnail($source, $destination, $mimetype) return false; } - $used_imagick = false; + $thumbnail_created = false; - // Only use ImageMagick if defined and the passthru function not disabled - if ($config['img_imagick'] && function_exists('passthru')) - { - if (substr($config['img_imagick'], -1) !== '/') - { - $config['img_imagick'] .= '/'; - } - - @passthru(escapeshellcmd($config['img_imagick']) . 'convert' . ((defined('PHP_OS') && preg_match('#^win#i', PHP_OS)) ? '.exe' : '') . ' -quality 85 -geometry ' . $new_width . 'x' . $new_height . ' "' . str_replace('\\', '/', $source) . '" "' . str_replace('\\', '/', $destination) . '"'); - - if (file_exists($destination)) - { - $used_imagick = true; - } - } + /** + * Create thumbnail event to replace GD thumbnail creation with for example ImageMagick + * + * @event core.thumbnail_create_before + * @var string source Image source path + * @var string destination Thumbnail destination path + * @var string mimetype Image mime type + * @var float new_width Calculated thumbnail width + * @var float new_height Calculated thumbnail height + * @var bool thumbnail_created Set to true to skip default GD thumbnail creation + * @since 3.2.4 + */ + $vars = array( + 'source', + 'destination', + 'mimetype', + 'new_width', + 'new_height', + 'thumbnail_created', + ); + extract($phpbb_dispatcher->trigger_event('core.thumbnail_create_before', compact($vars))); - if (!$used_imagick) + if (!$thumbnail_created) { $type = get_supported_image_types($type); |