Skip to content

Commit f2a119b

Browse files
committed
v1.0.0
1 parent 8ad8d87 commit f2a119b

File tree

18 files changed

+405
-98
lines changed

18 files changed

+405
-98
lines changed

README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# phpBB Image upload use ImageMagick
22

33
## Description
4-
This extension us the PHP Imagick class to modify upload image for improved quality.
5-
This extension can change the image size and/or the image file size. It rotate images and thumbnails according to their EXIF information and it can remove the EXIF data.
4+
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.
7+
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.
68

79
#### Settings in User Control Panel
810
- No settings.
@@ -14,17 +16,19 @@ This extension can change the image size and/or the image file size. It rotate i
1416
- Maximum image heigth.
1517
- Maximum image file size.
1618
- Remove EXIF data
19+
- Resize avatar
1720

1821
## Requirements
19-
- php 7.0 or higher
2022
- phpBB 3.2.4 or higher
21-
- php the Imagick class
23+
- php 7.1 or higher
24+
- php ImageMagick library installed
2225

2326
## Installation
2427
Copy the extension to `phpBB3/ext/imcger/imgupload`.
2528
Go to "ACP" > "Customise" > "Manage extensions" and enable the "Image upload use ImageMagick" extension.
2629
For full functionality "Maximum file size" in "ACP" > "Posting" > "Attachment settings" must be set to 0. This is done automatically during the migration.
2730
For full functionality "Maximum image dimensions" in "ACP" > "Posting" > "Attachment settings" must be set to 0. This is done automatically during the migration.
31+
For full functionality "Maximum avatar file size" in "ACP" > "Board configuration" > "Avatar settings" must be set to 0. This is done automatically during the migration.
2832

2933
## Update
3034
- Navigate in the ACP to `Customise -> Manage extensions`.
@@ -36,13 +40,14 @@ For full functionality "Maximum image dimensions" in "ACP" > "Posting" > "Attach
3640
## Changelog
3741

3842
### v1.0.0 (21-07-2022)
39-
- Version check
40-
- Check system requirement
41-
- Controller for ACP template
43+
- Add avatar resize
44+
- Add Version check
45+
- Add Controller for ACP template
46+
- Update check system requirement
4247
- Bug in EXIF orientation handling
4348

4449
### v0.1.0 (31-05-2022)
45-
- Error in migrations
50+
- Bug in migrations
4651

4752
### v0.0.4 (18-03-2022)
4853
- Cleanup Code

imcger/imgupload/README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# phpBB Image upload use ImageMagick
22

33
## Description
4-
This extension us the PHP imagick class to modify upload image for improved quality.
5-
This extension can change the image size and/or the image file size. It rotate images and thumbnails according to their EXIF information and it can remove the EXIF data.
4+
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.
7+
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.
68

79
#### Settings in User Control Panel
810
- No settings.
@@ -14,17 +16,19 @@ This extension can change the image size and/or the image file size. It rotate i
1416
- Maximum image heigth.
1517
- Maximum image file size.
1618
- Remove EXIF data
19+
- Resize avatar
1720

1821
## Requirements
19-
- php 7.0 or higher
2022
- phpBB 3.2.4 or higher
21-
- php the Imagick class
23+
- php 7.1 or higher
24+
- php ImageMagick library installed
2225

2326
## Installation
2427
Copy the extension to `phpBB3/ext/imcger/imgupload`.
2528
Go to "ACP" > "Customise" > "Manage extensions" and enable the "Image upload use ImageMagick" extension.
2629
For full functionality "Maximum file size" in "ACP" > "Posting" > "Attachment settings" must be set to 0. This is done automatically during the migration.
2730
For full functionality "Maximum image dimensions" in "ACP" > "Posting" > "Attachment settings" must be set to 0. This is done automatically during the migration.
31+
For full functionality "Maximum avatar file size" in "ACP" > "Board configuration" > "Avatar settings" must be set to 0. This is done automatically during the migration.
2832

2933
## Update
3034
- Navigate in the ACP to `Customise -> Manage extensions`.
@@ -36,6 +40,7 @@ For full functionality "Maximum image dimensions" in "ACP" > "Posting" > "Attach
3640
## Changelog
3741

3842
### v1.0.0 (21-07-2022)
43+
- Add avatar resize
3944
- Version check
4045
- Check system requirement
4146
- Controller for ACP template

imcger/imgupload/adm/style/acp_imgupload_body.html

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,23 @@
22

33
<h1>{{ lang('ACP_IMCGER_IMGUPLOAD_TITLE') }}</h1>
44

5+
<p>{{ lang('ACP_IMCGER_IMGUPLOAD_DESC') }}</p>
6+
57
<form id="acp_board" method="post" action="{{ U_ACTION }}">
68

79
<fieldset>
8-
<legend>{{ lang('ACP_IMCGER_SETTINGS') }}</legend>
10+
<legend>{{ lang('ACP_IMCGER_SETTINGS_THUMB') }}</legend>
911
<dl>
1012
<dt><label for="imcger_imgupload_tum_quality">{{ lang('ACP_IMCGER_THUMB_QUALITY') ~ lang('COLON') }}</label><br/><span>{{ lang('ACP_IMCGER_THUMB_QUALITY_DESC') }}</span></dt>
11-
<dd><input type="number" id="imcger_imgupload_tum_quality" min="10" max="100" step="any" maxlength="3" name="imcger_imgupload_tum_quality" value="{{ IMCGER_TUM_QUALITY }}" /></dd>
13+
<dd><input type="number" id="imcger_imgupload_tum_quality" min="50" max="90" step="any" maxlength="3" name="imcger_imgupload_tum_quality" value="{{ IMCGER_TUM_QUALITY }}" /></dd>
1214
</dl>
15+
</fieldset>
1316

17+
<fieldset>
18+
<legend>{{ lang('ACP_IMCGER_SETTINGS_IMAGE') }}</legend>
1419
<dl>
1520
<dt><label for="imcger_imgupload_img_quality">{{ lang('ACP_IMCGER_IMAGE_QUALITY') ~ lang('COLON') }}</label><br/><span>{{ lang('ACP_IMCGER_IMAGE_QUALITY_DESC') }}</span></dt>
16-
<dd><input type="number" id="imcger_imgupload_img_quality" min="10" max="100" step="any" maxlength="3" name="imcger_imgupload_img_quality" value="{{ IMCGER_IMG_QUALITY }}" /></dd>
21+
<dd><input type="number" id="imcger_imgupload_img_quality" min="50" max="90" step="any" maxlength="3" name="imcger_imgupload_img_quality" value="{{ IMCGER_IMG_QUALITY }}" /></dd>
1722
</dl>
1823

1924
<dl>
@@ -40,6 +45,18 @@ <h1>{{ lang('ACP_IMCGER_IMGUPLOAD_TITLE') }}</h1>
4045
</dl>
4146
</fieldset>
4247

48+
<fieldset>
49+
<legend>{{ lang('ACP_IMCGER_SETTINGS_AVATAR') }}</legend>
50+
<dl>
51+
<dt><label for="imcger_imgupload_avatar_resize">{{ lang('ACP_IMCGER_AVATAR_RESIZE') }} {{ lang('COLON') }}</label><br><span>{{ lang('ACP_IMCGER_AVATAR_RESIZE_DESC') }}</span>
52+
{% if IMCGER_AVATAR_FILESIZE_ISSET %}<br><span style="color: red">{{ lang('ACP_IMCGER_AVATAR_FILESIZE_ISSET') }}</span>{% endif %}</dt>
53+
<dd>
54+
<label><input type="radio" class="radio" id="imcger_imgupload_avatar_resize" name="imcger_imgupload_avatar_resize" value='1'{% if IMCGER_AVATAR_RESIZE %} checked="checked"{% endif %} /> {{ lang('YES') }}</label>
55+
<label><input type="radio" class="radio" name="imcger_imgupload_avatar_resize" value='0'{% if not IMCGER_AVATAR_RESIZE %} checked="checked"{% endif %} /> {{ lang('NO') }}</label>
56+
</dd>
57+
</dl>
58+
</fieldset>
59+
4360
<fieldset class="submit-buttons">
4461
<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />
4562
{S_FORM_TOKEN}

imcger/imgupload/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}
1515
],
1616
"require": {
17-
"php": ">=7.0.0",
17+
"php": ">=7.1.0",
1818
"phpbb/phpbb": ">=3.2.4",
1919
"composer/installers": "~1.0"
2020
},

imcger/imgupload/config/services.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ services:
1010
class: imcger\imgupload\event\main_listener
1111
arguments:
1212
- '@config'
13+
- '@language'
1314
tags:
1415
- { name: event.listener }

imcger/imgupload/controller/admin_controller.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,16 @@ public function display_options()
8080
$filesize = get_formatted_filesize($this->config['imcger_imgupload_max_filesize'], false, array('mb', 'kb', 'b'));
8181

8282
$this->template->assign_vars([
83-
'U_ACTION' => $this->u_action,
84-
'IMCGER_TUM_QUALITY' => $this->config['imcger_imgupload_tum_quality'],
85-
'IMCGER_IMG_QUALITY' => $this->config['imcger_imgupload_img_quality'],
86-
'IMCGER_MAX_WIDTH' => $this->config['imcger_imgupload_max_width'],
87-
'IMCGER_MAX_HEIGHT' => $this->config['imcger_imgupload_max_height'],
88-
'IMCGER_MAX_FILESIZE' => $filesize['value'],
89-
'IMCGER_UNIT' => $filesize['si_identifier'],
90-
'IMCGER_DEL_EXIF' => $this->config['img_strip_metadata'],
83+
'U_ACTION' => $this->u_action,
84+
'IMCGER_TUM_QUALITY' => $this->config['imcger_imgupload_tum_quality'],
85+
'IMCGER_IMG_QUALITY' => $this->config['imcger_imgupload_img_quality'],
86+
'IMCGER_MAX_WIDTH' => $this->config['imcger_imgupload_max_width'],
87+
'IMCGER_MAX_HEIGHT' => $this->config['imcger_imgupload_max_height'],
88+
'IMCGER_MAX_FILESIZE' => $filesize['value'],
89+
'IMCGER_UNIT' => $filesize['si_identifier'],
90+
'IMCGER_DEL_EXIF' => $this->config['img_strip_metadata'],
91+
'IMCGER_AVATAR_RESIZE' => $this->config['imcger_imgupload_avatar_resize'],
92+
'IMCGER_AVATAR_FILESIZE_ISSET' => (bool) $this->config['avatar_filesize'],
9193
]);
9294
}
9395

@@ -109,6 +111,7 @@ protected function set_variable()
109111
$this->config->set('imcger_imgupload_max_height', $this->request->variable('imcger_imgupload_max_height', 0));
110112
$this->config->set('imcger_imgupload_max_filesize', $max_filesize);
111113
$this->config->set('img_strip_metadata', $this->request->variable('imcger_imgupload_del_exif', 0));
114+
$this->config->set('imcger_imgupload_avatar_resize', $this->request->variable('imcger_imgupload_avatar_resize', 1));
112115
}
113116

114117
/**

0 commit comments

Comments
 (0)