aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2020-02-01 08:50:24 +0100
committerMarc Alexander <admin@m-a-styles.de>2020-02-01 08:50:24 +0100
commit2d5289ed7e126eeec22a9b1af977bfcd87371ec5 (patch)
treec3d52befd5ab2c6f77530a1af2ffeff67b1d865c
parentMerge branch '3.3.x' (diff)
parentMerge branch '3.2.x' into 3.3.x (diff)
downloadphpbb-master.tar.gz
phpbb-master.tar.bz2
phpbb-master.zip
Merge branch '3.3.x'HEADmaster
-rw-r--r--phpBB/includes/acp/acp_attachments.php2
-rw-r--r--phpBB/install/schemas/schema_data.sql2
-rw-r--r--phpBB/language/en/acp/attachments.php4
-rw-r--r--phpBB/phpbb/db/migration/data/v32x/add_plupload_config.php30
-rw-r--r--phpBB/phpbb/plupload/plupload.php7
-rw-r--r--tests/plupload/plupload_test.php10
6 files changed, 51 insertions, 4 deletions
diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php
index 56d99adb87..36522b9829 100644
--- a/phpBB/includes/acp/acp_attachments.php
+++ b/phpBB/includes/acp/acp_attachments.php
@@ -168,6 +168,8 @@ class acp_attachments
'img_max_thumb_width' => array('lang' => 'MAX_THUMB_WIDTH', 'validate' => 'int:0:999999999999999', 'type' => 'number:0:999999999999999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
'img_min_thumb_filesize' => array('lang' => 'MIN_THUMB_FILESIZE', 'validate' => 'int:0:999999999999999', 'type' => 'number:0:999999999999999', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']),
'img_max' => array('lang' => 'MAX_IMAGE_SIZE', 'validate' => 'int:0:9999', 'type' => 'dimension:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
+ 'img_strip_metadata' => array('lang' => 'IMAGE_STRIP_METADATA', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'img_quality' => array('lang' => 'IMAGE_QUALITY', 'validate' => 'int:50:90', 'type' => 'number:50:90', 'explain' => true, 'append' => ' &percnt;'),
'img_link' => array('lang' => 'IMAGE_LINK_SIZE', 'validate' => 'int:0:9999', 'type' => 'dimension:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
)
);
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index 5441accc43..655c379fca 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -154,6 +154,8 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_max_height', '
INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_max_thumb_width', '400');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_max_width', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_min_thumb_filesize', '12000');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_quality', '85');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_strip_metadata', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ip_check', '3');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ip_login_limit_max', '50');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ip_login_limit_time', '21600');
diff --git a/phpBB/language/en/acp/attachments.php b/phpBB/language/en/acp/attachments.php
index 67454f8b76..6699b00b70 100644
--- a/phpBB/language/en/acp/attachments.php
+++ b/phpBB/language/en/acp/attachments.php
@@ -109,6 +109,10 @@ $lang = array_merge($lang, array(
'IMAGE_LINK_SIZE' => 'Image link dimensions',
'IMAGE_LINK_SIZE_EXPLAIN' => 'Display image attachment as an inline text link if image is larger than this. To disable this behaviour, set the values to 0px by 0px.',
+ 'IMAGE_QUALITY' => 'Quality of uploaded image attachments (JPEG only)',
+ 'IMAGE_QUALITY_EXPLAIN' => 'Specify value between 50% (smaller file size) and 90% (higher quality). Quality higher than 90% increases filesize and is disabled. Setting only applies if maximum image dimensions are set to a value other than 0px by 0px.',
+ 'IMAGE_STRIP_METADATA' => 'Strip image metadata (JPEG only)',
+ 'IMAGE_STRIP_METADATA_EXPLAIN' => 'Strip Exif metadata, e.g. author name, GPS coordinates and camera details. Setting only applies if maximum image dimensions are set to a value other than 0px by 0px.',
'MAX_ATTACHMENTS' => 'Maximum number of attachments per post',
'MAX_ATTACHMENTS_PM' => 'Maximum number of attachments per private message',
diff --git a/phpBB/phpbb/db/migration/data/v32x/add_plupload_config.php b/phpBB/phpbb/db/migration/data/v32x/add_plupload_config.php
new file mode 100644
index 0000000000..d708155807
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v32x/add_plupload_config.php
@@ -0,0 +1,30 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v32x;
+
+class add_plupload_config extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return ['\phpbb\db\migration\data\v32x\v329'];
+ }
+
+ public function update_data()
+ {
+ return [
+ ['config.add', ['img_quality', '85']],
+ ['config.add', ['img_strip_metadata', '0']],
+ ];
+ }
+}
diff --git a/phpBB/phpbb/plupload/plupload.php b/phpBB/phpbb/plupload/plupload.php
index 80d7e914db..a94fbb7617 100644
--- a/phpBB/phpbb/plupload/plupload.php
+++ b/phpBB/phpbb/plupload/plupload.php
@@ -263,10 +263,13 @@ class plupload
$resize = '';
if ($this->config['img_max_height'] > 0 && $this->config['img_max_width'] > 0)
{
+ $preserve_headers_value = $this->config['img_strip_metadata'] ? 'false' : 'true';
$resize = sprintf(
- 'resize: {width: %d, height: %d, quality: 85},',
+ 'resize: {width: %d, height: %d, quality: %d, preserve_headers: %s},',
(int) $this->config['img_max_width'],
- (int) $this->config['img_max_height']
+ (int) $this->config['img_max_height'],
+ (int) $this->config['img_quality'],
+ $preserve_headers_value
);
}
diff --git a/tests/plupload/plupload_test.php b/tests/plupload/plupload_test.php
index eb4657afbc..206029d8b8 100644
--- a/tests/plupload/plupload_test.php
+++ b/tests/plupload/plupload_test.php
@@ -19,12 +19,16 @@ class phpbb_plupload_test extends phpbb_test_case
array(
0,
0,
+ 85,
+ 0,
'',
),
array(
130,
150,
- 'resize: {width: 130, height: 150, quality: 85},'
+ 85,
+ 1,
+ 'resize: {width: 130, height: 150, quality: 85, preserve_headers: false},'
),
);
}
@@ -32,7 +36,7 @@ class phpbb_plupload_test extends phpbb_test_case
/**
* @dataProvider generate_resize_string_data
*/
- public function test_generate_resize_string($config_width, $config_height, $expected)
+ public function test_generate_resize_string($config_width, $config_height, $config_quality, $config_metadata, $expected)
{
global $phpbb_root_path, $phpEx;
@@ -41,6 +45,8 @@ class phpbb_plupload_test extends phpbb_test_case
$config = new \phpbb\config\config(array(
'img_max_width' => $config_width,
'img_max_height' => $config_height,
+ 'img_quality' => $config_quality,
+ 'img_strip_metadata' => $config_metadata,
'upload_path' => 'files',
));
$plupload = new \phpbb\plupload\plupload(