1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-14 12:52:08 +02:00

[ticket/16329] Add configuration options for Plupload

PHPBB3-16329
PHPBB3-16330
This commit is contained in:
KYPREO 2020-01-20 15:19:56 +11:00
parent 880deabac1
commit a1617548cf
5 changed files with 58 additions and 5 deletions

View File

@ -169,6 +169,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:1:100', 'type' => 'number:1:100', 'explain' => true, 'append' => ' %'),
'img_link' => array('lang' => 'IMAGE_LINK_SIZE', 'validate' => 'int:0:9999', 'type' => 'dimension:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
)
);

View File

@ -155,6 +155,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', '90');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_strip_metadata', '1');
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');

View File

@ -111,6 +111,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 for image compression',
'IMAGE_QUALITY_EXPLAIN' => 'Higher value means lower compression/larger file size. Default 90%. Setting is only effective if max image dimensions set to value other than 0px v 0px, but will then apply to all uploaded JPEG images',
'IMAGE_STRIP_METADATA' => 'Strip image metadata',
'IMAGE_STRIP_METADATA_EXPLAIN' => 'Strip Exif metadata eg author name, GPS coordinates & camera details (JPEG only). Setting is only effective if max image dimensions set to value other than 0px v 0px.',
'MAX_ATTACHMENTS' => 'Maximum number of attachments per post',
'MAX_ATTACHMENTS_PM' => 'Maximum number of attachments per private message',

View File

@ -0,0 +1,32 @@
<?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 enable_plupload_config extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v32x\v329',
);
}
public function update_data()
{
return array(
array('config.add', array('img_quality', '90')),
array('config.add', array('img_strip_metadata', '1')),
);
}
}

View File

@ -263,11 +263,24 @@ class plupload
$resize = '';
if ($this->config['img_max_height'] > 0 && $this->config['img_max_width'] > 0)
{
$resize = sprintf(
'resize: {width: %d, height: %d, quality: 85},',
(int) $this->config['img_max_width'],
(int) $this->config['img_max_height']
);
if ($this->config['img_strip_metadata'] == 1)
{
$resize = sprintf(
'resize: {width: %d, height: %d, quality: %d, preserve_headers: false},',
(int) $this->config['img_max_width'],
(int) $this->config['img_max_height'],
(int) $this->config['img_quality']
);
}
else
{
$resize = sprintf(
'resize: {width: %d, height: %d, quality: %d},',
(int) $this->config['img_max_width'],
(int) $this->config['img_max_height'],
(int) $this->config['img_quality']
);
}
}
return $resize;