Skip to content

Commit f5243bb

Browse files
committed
v1.1.1
- Fixed don't show preview thumbnail in attachments upload - Added support for Lightbox and Fancybox - Added show language author in ACP dialog - Changed check system requirement
1 parent d3cea9b commit f5243bb

22 files changed

+201
-195
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
## Description
44
This extension is a further development of [canonknipser](https://www.phpbb.com/customise/db/author/canonknipser) [ImageMagick Thumbnailer](https://www.phpbb.com/customise/db/extension/imagemagick_thumbnailer).
5-
The extension uses the PHP imagick class to modify uploaded images, thumbnails and avatars. If the values set in the ACP are exceeded by the image file, the image is being resized by the extension.
6-
The extension supports JPEG, WEBP, GIF and PNG images. Other image formats, for example BMP, are ​convert​ed​ to JPEG when resize​d.
5+
The extension uses the PHP imagick class to modify uploaded images, thumbnails and avatars. It shows a preview image in attachments upload. If the values set in the ACP are exceeded by the image file, the image is being resized by the extension.
6+
The extension supports JPEG, WEBP, GIF and PNG images. Other image formats, for example BMP, are converted to JPEG when resized.
77
This extension can change the image size and/or the image file size. It rotate images, thumbnails and avatars according to their EXIF information and it can remove the EXIF data from JPEG and WEBP files.
88

99
#### Settings in User Control Panel
@@ -28,6 +28,11 @@ This extension can change the image size and/or the image file size. It rotate i
2828
- php 7.1 or higher
2929
- php ImageMagick library installed
3030

31+
## Compatible with
32+
- Fancybox (`lotusjeff/fancybox`)
33+
- Fancybox (`imcger/fancybox`)
34+
- Lightbox (`vse/lightbox`)
35+
3136
## Installation
3237
Copy the extension to `phpBB3/ext/imcger/imgupload`.
3338
Go to "ACP" > "Customise" > "Manage extensions" and enable the "Image upload use ImageMagick" extension.
@@ -46,6 +51,12 @@ For full functionality "Maximum avatar file size" in "ACP" > "Board configuratio
4651

4752
## Changelog
4853

54+
### v1.1.1 (18-03-2023)
55+
- Fixed don't show preview thumbnail in attachments upload
56+
- Added support for Lightbox and Fancybox
57+
- Added show language author in ACP dialog
58+
- Changed check system requirement
59+
4960
### v1.1.0 (06-02-2023)
5061
- Added preview image in attachments upload
5162
- Changed in ACP from radio to toggle button

imcger/imgupload/README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
## Description
44
This extension is a further development of [canonknipser](https://www.phpbb.com/customise/db/author/canonknipser) [ImageMagick Thumbnailer](https://www.phpbb.com/customise/db/extension/imagemagick_thumbnailer).
5-
The extension uses the PHP imagick class to modify uploaded images, thumbnails and avatars. If the values set in the ACP are exceeded by the image file, the image is being resized by the extension.
6-
The extension supports JPEG, WEBP, GIF and PNG images. Other image formats, for example BMP, are ​convert​ed​ to JPEG when resize​d.
5+
The extension uses the PHP imagick class to modify uploaded images, thumbnails and avatars. It shows a preview image in attachments upload. If the values set in the ACP are exceeded by the image file, the image is being resized by the extension.
6+
The extension supports JPEG, WEBP, GIF and PNG images. Other image formats, for example BMP, are converted to JPEG when resized.
77
This extension can change the image size and/or the image file size. It rotate images, thumbnails and avatars according to their EXIF information and it can remove the EXIF data from JPEG and WEBP files.
88

99
#### Settings in User Control Panel
@@ -28,6 +28,11 @@ This extension can change the image size and/or the image file size. It rotate i
2828
- php 7.1 or higher
2929
- php ImageMagick library installed
3030

31+
## Compatible with
32+
- Fancybox (`lotusjeff/fancybox`)
33+
- Fancybox (`imcger/fancybox`)
34+
- Lightbox (`vse/lightbox`)
35+
3136
## Installation
3237
Copy the extension to `phpBB3/ext/imcger/imgupload`.
3338
Go to "ACP" > "Customise" > "Manage extensions" and enable the "Image upload use ImageMagick" extension.
@@ -46,6 +51,12 @@ For full functionality "Maximum avatar file size" in "ACP" > "Board configuratio
4651

4752
## Changelog
4853

54+
### v1.1.1 (18-03-2023)
55+
- Fixed don't show preview thumbnail in attachments upload
56+
- Added support for Lightbox and Fancybox
57+
- Added show language author in ACP dialog
58+
- Changed check system requirement
59+
4960
### v1.1.0 (06-02-2023)
5061
- Added preview image in attachments upload
5162
- Changed in ACP from radio to toggle button
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
Image upload use ImageMagick
3+
------------------------------------- */
4+
5+
.imcger_copyright {
6+
margin-top: 1em;
7+
text-align: center;
8+
font-size: 0.75em;
9+
}

imcger/imgupload/adm/style/acp_imgupload_body.html

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,26 @@ <h1>{{ lang('ACP_IMCGER_IMGUPLOAD_TITLE') }}</h1>
5050
</dl>
5151
</fieldset>
5252

53-
<fieldset class="submit-buttons">
54-
<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}">
53+
<fieldset>
54+
<legend>{{ lang('ACP_SUBMIT_CHANGES') }}</legend>
55+
<p class="submit-buttons">
56+
<input class="button1" type="submit" id="submit" name="submit" value="{{ lang('SUBMIT') }}">&nbsp;
57+
<input class="button2" type="reset" id="reset" name="reset" value="{{ lang('RESET') }}">
58+
</p>
5559
</fieldset>
56-
60+
5761
{{ S_FORM_TOKEN }}
5862
</form>
5963

64+
<p class="imcger_copyright">
65+
{{ IMGUPLOAD_TITLE }} v{{ IMGUPLOAD_EXT_VER }} &copy; IMC-Ger<br>
66+
{{ lang('ACP_IMCGER_LANG_DESC') }} v{{ lang('ACP_IMCGER_LANG_EXT_VER') }} &bull; {{ lang('ACP_IMCGER_LANG_AUTHOR') }}
67+
</p>
68+
6069
{% INCLUDE 'overall_footer.html' %}
6170

6271
{% INCLUDECSS '@imcger_imgupload/acp_toggle.css' %}
72+
{% INCLUDECSS '@imcger_imgupload/acp_imgupload.css' %}
6373

6474
{% macro switch(name, checked = false) -%}
6575
<input type="checkbox" class="toggle" name="{{ name }}" value="1"{{ checked ? ' checked' }}>

imcger/imgupload/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"type": "phpbb-extension",
44
"description": "Using ImageMagick php librarie for resize image attachments and creating thumbnails.",
55
"homepage": "https://github.com/IMC-GER/phpBB-Image-upload-use-ImageMagick/tags",
6-
"version": "1.1.0",
7-
"time": "2023-02-06",
6+
"version": "1.1.1",
7+
"time": "2023-03-18",
88
"license": "GPL-2.0-only",
99
"authors": [{
1010
"name": "Thorsten Ahlers",

imcger/imgupload/config/services.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ services:
66
- '@template'
77
- '@language'
88
- '@request'
9+
- '@ext.manager'
910

1011
imcger.imgupload.listener:
1112
class: imcger\imgupload\event\main_listener

imcger/imgupload/controller/admin_controller.php

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,35 @@ class admin_controller
2525
/** @var request */
2626
protected $request;
2727

28+
/** @var \phpbb\extension\manager */
29+
protected $ext_manager;
30+
2831
/** @var string Custom form action */
2932
protected $u_action;
3033

3134
/**
3235
* Constructor
3336
*
34-
* @param config $config
35-
* @param template $template
36-
* @param language $language
37-
* @param request $request
37+
* @param \phpbb\config\config $config
38+
* @param \phpbb\template\template $template
39+
* @param \phpbb\language\language $language
40+
* @param \phpbb\request\request $request
41+
* @param \phpbb\extension\manager $ext_manager
3842
*
3943
*/
4044
public function __construct(
4145
\phpbb\config\config $config,
4246
\phpbb\template\template $template,
4347
\phpbb\language\language $language,
44-
\phpbb\request\request $request
48+
\phpbb\request\request $request,
49+
\phpbb\extension\manager $ext_manager
4550
)
4651
{
47-
$this->config = $config;
48-
$this->template = $template;
49-
$this->language = $language;
50-
$this->request = $request;
52+
$this->config = $config;
53+
$this->template = $template;
54+
$this->language = $language;
55+
$this->request = $request;
56+
$this->ext_manager = $ext_manager;
5157
}
5258

5359
/**
@@ -77,10 +83,14 @@ public function display_options()
7783
trigger_error($this->language->lang('ACP_IMCGER_SETTINGS_SAVED') . adm_back_link($this->u_action));
7884
}
7985

86+
$metadata_manager = $this->ext_manager->create_extension_metadata_manager('imcger/imgupload');
87+
8088
$filesize = get_formatted_filesize($this->config['imcger_imgupload_max_filesize'], false, array('mb', 'kb', 'b'));
8189

8290
$this->template->assign_vars([
8391
'U_ACTION' => $this->u_action,
92+
'IMGUPLOAD_TITLE' => $metadata_manager->get_metadata('display-name'),
93+
'IMGUPLOAD_EXT_VER' => $metadata_manager->get_metadata('version'),
8494
'IMCGER_TUM_QUALITY' => $this->config['imcger_imgupload_tum_quality'],
8595
'IMCGER_IMG_QUALITY' => $this->config['imcger_imgupload_img_quality'],
8696
'IMCGER_MAX_WIDTH' => $this->config['imcger_imgupload_max_width'],

imcger/imgupload/event/main_listener.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ public function set_template_vars()
9696
{
9797
$allowed_images = '';
9898

99-
$sql = 'SELECT extension FROM ' . EXTENSIONS_TABLE . ' WHERE group_id = 1';
99+
$sql = 'SELECT group_id FROM ' . EXTENSION_GROUPS_TABLE . ' WHERE group_name = "IMAGES"';
100+
$result = $this->db->sql_query($sql);
101+
$row = $this->db->sql_fetchrow($result);
102+
$this->db-> sql_freeresult();
103+
104+
$sql = 'SELECT extension FROM ' . EXTENSIONS_TABLE . ' WHERE group_id = ' . $row["group_id"];
100105
$result = $this->db->sql_query($sql);
101106

102107
while ($row = $this->db->sql_fetchrow($result))
@@ -107,6 +112,7 @@ public function set_template_vars()
107112

108113
$this->template->assign_vars([
109114
'IUL_ALLOWED_IMAGES' => $allowed_images,
115+
'IUL_GET_THUMBNAIL' => $this->config['img_create_thumbnail'],
110116
]);
111117
}
112118

imcger/imgupload/ext.php

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@
1616
*/
1717
class ext extends \phpbb\extension\base
1818
{
19+
/** @var Extension name */
20+
protected $ext_name = 'imgupload';
21+
22+
/** @var min phpBB version */
23+
protected $phpbb_min_version = '3.2.4';
24+
25+
/** @var max phpBB version (>= query) */
26+
protected $phpbb_max_version = '4.0.0';
27+
28+
/** @var min PHP version */
29+
protected $php_min_version = '7.1.0';
30+
31+
/** @var max PHP version (>= query) */
32+
protected $php_max_version = '8.3.0';
33+
1934
/**
2035
* Check the minimum and maximum requirements.
2136
*
@@ -30,25 +45,25 @@ public function is_enableable()
3045
}
3146

3247
$language = $this->container->get('language');
33-
$language->add_lang('imgupload_acp', 'imcger/imgupload');
48+
$language->add_lang('info_acp_' . $this->ext_name, 'imcger/' . $this->ext_name);
3449
$error_message = [];
3550

3651
// Imagick library installed?
3752
if (!class_exists('Imagick'))
3853
{
39-
$error_message += ['error1' => $language->lang('IMCGER_IM_REQUIRE_IMAGICK')];
54+
$error_message += [$language->lang('IMCGER_REQUIRE_IMAGICK')];
4055
}
4156

42-
// phpBB version greater equal 3.2.4 and less then 4.0
43-
if (phpbb_version_compare(PHPBB_VERSION, '3.2.4', '<') || phpbb_version_compare(PHPBB_VERSION, '4.0.0', '>='))
57+
// phpBB version greater equal $phpbb_min_version and less then $phpbb_max_version
58+
if (phpbb_version_compare(PHPBB_VERSION, $this->phpbb_min_version, '<') || phpbb_version_compare(PHPBB_VERSION, $this->phpbb_max_version, '>='))
4459
{
45-
$error_message += ['error2' => $language->lang('IMCGER_IM_REQUIRE_PHPBB'),];
60+
$error_message += [$language->lang('IMCGER_REQUIRE_PHPBB', $this->phpbb_min_version, $this->phpbb_max_version, PHPBB_VERSION),];
4661
}
4762

48-
// php version equal or greater 7.1.0 and less 8.2
49-
if (version_compare(PHP_VERSION, '7.1.0', '<') || version_compare(PHP_VERSION, '8.3', '>='))
63+
// php version equal or greater $php_min_version and less $php_max_version
64+
if (version_compare(PHP_VERSION, $this->php_min_version, '<') || version_compare(PHP_VERSION, $this->php_max_version, '>='))
5065
{
51-
$error_message += ['error3' => $language->lang('IMCGER_IM_REQUIRE_PHP'),];
66+
$error_message += [$language->lang('IMCGER_REQUIRE_PHP', $this->php_min_version, $this->php_max_version, PHP_VERSION),];
5267
}
5368

5469
// When phpBB v3.2 use trigger_error() for message output. For v3.1 return false.

imcger/imgupload/language/de/common.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
if (empty($lang) || !is_array($lang))
1818
{
19-
$lang = array();
19+
$lang = [];
2020
}
2121

2222
// DEVELOPERS PLEASE NOTE
@@ -35,12 +35,19 @@
3535
// ’ » “ ” …
3636
//
3737

38-
$lang = array_merge($lang, array(
38+
$lang = array_merge($lang, [
3939

40+
// Language pack author
41+
'ACP_IMCGER_LANG_DESC' => 'Deutsch (Du)',
42+
'ACP_IMCGER_LANG_EXT_VER' => '1.1.1',
43+
'ACP_IMCGER_LANG_AUTHOR' => 'IMC-Ger',
44+
45+
// Messages
4046
'ACP_IMCGER_SETTINGS_SAVED' => 'Einstellungen wurden erfolgreich gespeichert.',
4147

48+
// ACP settings
4249
'ACP_IMCGER_IMGUPLOAD_TITLE' => 'Image upload use ImageMagick',
43-
'ACP_IMCGER_IMGUPLOAD_DESC' => 'Die Erweiterung verwendet die PHP Imagick Klasse, um hochgeladene Bilder, Thumbnails und Avatars zu verändern. Wenn die im ACP eingestellten Werte von der Bilddatei überschritten werden, wird die Größe des Bildes von der Erweiterung angepasst.<br>Die Erweiterung unterstützt JPEG, WEBP, GIF und PNG Bilder. Andere Bildformate, z. B. BMP, werden beim Ändern der Größe in JPEG umgewandelt.<br>Diese Erweiterung kann die Bildgröße und/oder die Größe der Bilddatei ändern. Es dreht Bilder, Thumbnails und Avatare entsprechend ihrer EXIF Informationen und kann die EXIF Daten aus JPEG und WEBP Dateien entfernen.',
50+
'ACP_IMCGER_IMGUPLOAD_DESC' => 'Die Erweiterung verwendet die PHP Imagick Klasse, um hochgeladene Bilder, Thumbnails und Avatars zu verändern. Wenn die im ACP eingestellten Werte von der Bilddatei überschritten werden, wird die Größe des Bildes von der Erweiterung angepasst. Die Erweiterung unterstützt JPEG, WEBP, GIF und PNG Bilder. Andere Bildformate, z. B. BMP, werden beim Ändern der Größe in JPEG umgewandelt. Diese Erweiterung kann die Bildgröße und/oder die Größe der Bilddatei ändern. Es dreht Bilder, Thumbnails und Avatare entsprechend ihrer EXIF Informationen und kann die EXIF Daten aus JPEG und WEBP Dateien entfernen.',
4451

4552
'ACP_IMCGER_SETTINGS_THUMB' => 'Vorschaubild Einstellungen',
4653
'ACP_IMCGER_SETTINGS_IMAGE' => 'Bild Einstellungen',
@@ -64,4 +71,4 @@
6471
'ACP_IMCGER_AVATAR_RESIZE' => 'Avatar Größe anpassen',
6572
'ACP_IMCGER_AVATAR_RESIZE_DESC' => 'Die Bilddatei des Avatar wird beim Hochladen automatisch verkleinert.',
6673
'ACP_IMCGER_AVATAR_FILESIZE_ISSET' => 'Für diese Funktion muss die "Maximale Dateigröße" des Avatars auf 0 gesetzt werden.',
67-
));
74+
]);

0 commit comments

Comments
 (0)