mirror of
https://github.com/torrentpier/torrentpier
synced 2025-07-14 17:13:11 -07:00
WIP: Added avif images support 🌄 (#1660)
* WIP: Added avif images support * Update CHANGELOG.md * Update admin_ranks.php
This commit is contained in:
parent
04e1adf4ba
commit
0587f7a035
7 changed files with 12 additions and 8 deletions
|
@ -7,6 +7,7 @@
|
|||
|
||||
- Release 2.4.5 🦕 ([belomaxorka](https://github.com/belomaxorka))
|
||||
- [CLI] TorrentPier installer ☕️ [\#1576](https://github.com/torrentpier/torrentpier/pull/1576), [\#1582](https://github.com/torrentpier/torrentpier/pull/1582), [\#1585](https://github.com/torrentpier/torrentpier/pull/1585), [\#1591](https://github.com/torrentpier/torrentpier/pull/1591) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Added avif images support 🌄 [\#1660](https://github.com/torrentpier/torrentpier/pull/1660) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Added some new HTML meta-tags [\#1562](https://github.com/torrentpier/torrentpier/pull/1562) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Added robots meta-tag support 🤖 [\#1587](https://github.com/torrentpier/torrentpier/pull/1587) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Added [TorrServer](https://github.com/YouROK/TorrServer) instance support! 🎞 [\#1603](https://github.com/torrentpier/torrentpier/pull/1603), [\#1623](https://github.com/torrentpier/torrentpier/pull/1623), [\#1624](https://github.com/torrentpier/torrentpier/pull/1624), [\#1628](https://github.com/torrentpier/torrentpier/pull/1628) ([belomaxorka](https://github.com/belomaxorka))
|
||||
|
|
|
@ -83,7 +83,7 @@ if ($mode != '') {
|
|||
// The rank image has to be a jpg, gif or png
|
||||
//
|
||||
if ($rank_image != '') {
|
||||
if (!preg_match('/(\.gif|\.png|\.jpg|\.jpeg|\.bmp|\.webp|\.ico)$/is', $rank_image)) {
|
||||
if (!preg_match('/(\.gif|\.png|\.jpg|\.jpeg|\.bmp|\.webp|\.avif\.ico)$/is', $rank_image)) {
|
||||
$rank_image = '';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -701,6 +701,7 @@ VALUES ('1', 'gif', ''),
|
|||
('1', 'jpeg', ''),
|
||||
('1', 'jpg', ''),
|
||||
('1', 'webp', ''),
|
||||
('1', 'avif', ''),
|
||||
('1', 'bmp', ''),
|
||||
('2', 'gtar', ''),
|
||||
('2', 'gz', ''),
|
||||
|
|
|
@ -613,7 +613,8 @@ $bb_cfg['file_id_ext'] = [
|
|||
9 => 'zip',
|
||||
10 => '7z',
|
||||
11 => 'bmp',
|
||||
12 => 'webp'
|
||||
12 => 'webp',
|
||||
13 => 'avif'
|
||||
];
|
||||
|
||||
// Attachments
|
||||
|
@ -627,7 +628,7 @@ $bb_cfg['gen_forums_allowed_ext'] = ['zip', 'rar']; // TODO: For regular section
|
|||
|
||||
// Avatars
|
||||
$bb_cfg['avatars'] = [
|
||||
'allowed_ext' => ['gif', 'jpg', 'png', 'bmp', 'webp'], // Allowed file extensions (after changing, do the same for $bb_cfg['file_id_ext'])
|
||||
'allowed_ext' => ['gif', 'jpg', 'png', 'bmp', 'webp', 'avif'], // Allowed file extensions (after changing, do the same for $bb_cfg['file_id_ext'])
|
||||
'bot_avatar' => '/gallery/bot.gif', // The bot's avatar
|
||||
'max_size' => 100 * 1024, // Avatar's allowed dimensions
|
||||
'max_height' => 100, // Avatar height in px
|
||||
|
@ -640,7 +641,7 @@ $bb_cfg['avatars'] = [
|
|||
|
||||
// Group avatars
|
||||
$bb_cfg['group_avatars'] = [
|
||||
'allowed_ext' => ['gif', 'jpg', 'png', 'bmp', 'webp'], // Allowed file extensions (add the same for $bb_cfg['file_id_ext'])
|
||||
'allowed_ext' => ['gif', 'jpg', 'png', 'bmp', 'webp', 'avif'], // Allowed file extensions (add the same for $bb_cfg['file_id_ext'])
|
||||
'max_size' => 300 * 1024, // max avatar size in bytes
|
||||
'max_height' => 300, // Avatar height in px
|
||||
'max_width' => 300, // Avatar weight in px
|
||||
|
|
|
@ -78,7 +78,7 @@ class BBCode
|
|||
private function init_replacements(): void
|
||||
{
|
||||
$tpl = $this->tpl;
|
||||
$img_exp = '(https?:)?//[^\s\?&;=\#\"<>]+?\.(jpg|jpeg|gif|png|bmp|webp)([a-z0-9/?&%;][^\[\]]*)?';
|
||||
$img_exp = '(https?:)?//[^\s\?&;=\#\"<>]+?\.(jpg|jpeg|gif|png|bmp|webp|avif)([a-z0-9/?&%;][^\[\]]*)?';
|
||||
$email_exp = '[a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+';
|
||||
|
||||
$this->preg = [
|
||||
|
|
|
@ -86,7 +86,8 @@ class Upload
|
|||
IMAGETYPE_JPEG => 'jpg',
|
||||
IMAGETYPE_PNG => 'png',
|
||||
IMAGETYPE_BMP => 'bmp',
|
||||
IMAGETYPE_WEBP => 'webp'
|
||||
IMAGETYPE_WEBP => 'webp',
|
||||
IMAGETYPE_AVIF => 'avif'
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
@ -374,8 +374,8 @@ var TPL = {
|
|||
reg: {
|
||||
num : /^\d+$/,
|
||||
URL : /^https?:\/\/[\w\#$%&~/.\-;:=?@\[\]+]+$/i,
|
||||
img : /^https?:\/\/[^\s\?&;:=\#\"<>]+\.(jpg|jpeg|gif|png|bmp|webp)$/i,
|
||||
img_tag : /(https?:\/\/[^\s\?&;:=\#\"<>]+\.(jpg|jpeg|gif|png|bmp|webp)(?!\[|\]|\.))/ig
|
||||
img : /^https?:\/\/[^\s\?&;:=\#\"<>]+\.(jpg|jpeg|gif|png|bmp|webp|avif)$/i,
|
||||
img_tag : /(https?:\/\/[^\s\?&;:=\#\"<>]+\.(jpg|jpeg|gif|png|bmp|webp|avif)(?!\[|\]|\.))/ig
|
||||
},
|
||||
|
||||
// построение сообщения на основе данных из формы
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue