Skip to content

Commit ec2ece2

Browse files
committed
v1.4.1
1 parent 440e27a commit ec2ece2

File tree

9 files changed

+83
-5
lines changed

9 files changed

+83
-5
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ For full functionality "Maximum avatar file size" in "ACP" > "Board configuratio
5454

5555
## Changelog
5656

57+
### v1.4.1 (18-01-2024)
58+
- Set save-button background green when image is rotated
59+
- Open confirmbox if the image has not been saved after rotation
60+
5761
### v1.4.0 (14-01-2024)
5862
- Revised JS code
5963
- Fixed JS code in ACP don't work with radio buttons

imcger/imgupload/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ For full functionality "Maximum avatar file size" in "ACP" > "Board configuratio
5454

5555
## Changelog
5656

57+
### v1.4.1 (18-01-2024)
58+
- Set save-button background green when image is rotated
59+
- Open confirmbox if the image has not been saved after rotation
60+
5761
### v1.4.0 (14-01-2024)
5862
- Revised JS code
5963
- Fixed JS code in ACP don't work with radio buttons

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.4.0",
7-
"time": "2024-01-14",
6+
"version": "1.4.1",
7+
"time": "2024-01-18",
88
"license": "GPL-2.0-only",
99
"authors": [
1010
{

imcger/imgupload/language/de/attachment.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
'IUL_PLACE_INLINE' => 'Vorschaubild im Beitrag anzeigen',
4040
'IUL_IMAGE_PLACE_INLINE' => 'Bild im Beitrag anzeigen',
4141

42+
// Confirmbox
43+
'IUL_CONFIRMBOX_TEXT1' => 'Folgende Bilder wurden gedreht, jedoch nicht gespeichert.',
44+
'IUL_CONFIRMBOX_TEXT2' => 'Möchtest du fortfahren ohne die Drehung der Bilder zu speichern?',
45+
4246
// Errors from XMLHttpRequest
4347
'IUL_REQUEST_ERROR' => 'Bei der Anfrage ist ein Fehler aufgetreten.',
4448
'IUL_WRONG_PARAM' => 'Falsche Parameter gesendet.',

imcger/imgupload/language/de_x_sie/attachment.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
'IUL_PLACE_INLINE' => 'Vorschaubild im Beitrag anzeigen',
4040
'IUL_IMAGE_PLACE_INLINE' => 'Bild im Beitrag anzeigen',
4141

42+
// Confirmbox
43+
'IUL_CONFIRMBOX_TEXT1' => 'Folgende Bilder wurden gedreht, jedoch nicht gespeichert.',
44+
'IUL_CONFIRMBOX_TEXT2' => 'Möchten sie fortfahren ohne die Drehung der Bilder zu speichern?',
45+
4246
// Errors from XMLHttpRequest
4347
'IUL_REQUEST_ERROR' => 'Bei der Anfrage ist ein Fehler aufgetreten.',
4448
'IUL_WRONG_PARAM' => 'Falsche Parameter gesendet.',

imcger/imgupload/language/en/attachment.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
'IUL_PLACE_INLINE' => 'Place thumbnail inline',
4040
'IUL_IMAGE_PLACE_INLINE' => 'Place image inline',
4141

42+
// Confirmbox
43+
'IUL_CONFIRMBOX_TEXT1' => 'The following images were rotated but not saved.',
44+
'IUL_CONFIRMBOX_TEXT2' => 'Do you want to continue without saving the rotation of the images?',
45+
4246
// Errors from XMLHttpRequest
4347
'IUL_REQUEST_ERROR' => 'The request encountered an error.',
4448
'IUL_WRONG_PARAM' => 'Wrong parameter.',

imcger/imgupload/styles/all/template/event/overall_footer_body_after.html

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,15 @@
138138
});
139139
}
140140
});
141+
142+
if (deg != 0) {
143+
$('[data-attach-id="' + attach_id + '"]').find('.save-image').css({
144+
'background-color': '#22f822',
145+
'background-image': 'unset'
146+
});
147+
} else {
148+
$('[data-attach-id="' + attach_id + '"]').find('.save-image').removeAttr( 'style' );
149+
}
141150
},
142151

143152
/**
@@ -262,6 +271,7 @@
262271
imcger.imgUpload.updateAttId(response.oldAttachId, response.newAttachId);
263272
imcger.imgUpload.image.imgOrientationValue[index] = 0;
264273
imcger.imgUpload.image.updateImgFileSize(response.newAttachId, response.fileSize);
274+
$('[data-attach-id="' + response.newAttachId + '"]').find('.save-image').removeAttr( 'style' );
265275

266276
// Display a message when a warning occurs
267277
if (response.message) {
@@ -425,6 +435,48 @@
425435
$textarea.val(text);
426436
};
427437

438+
/**
439+
* Open a confirmbox when preview or save post
440+
* and rotated images have not been saved
441+
*/
442+
$('.submit-buttons').on('click', '.button1', function(e) {
443+
imcger.imgUpload.submitType = $(e.target).attr('name');
444+
let attach_id = 0,
445+
imgHTMLList = '<ul>';
446+
447+
// Are all images saved?
448+
$.each(imcger.imgUpload.image.imgOrientationValue, function(index, value) {
449+
450+
if (value != 0) {
451+
attach_id = imcger.imgUpload.image.imgOrientationIndex[index];
452+
453+
imgHTMLList += '<li>' + $('#img-' + attach_id).attr('title');
454+
}
455+
});
456+
imgHTMLList += '</ul>';
457+
458+
// If one or more images not save open confirmbox
459+
if (attach_id) {
460+
let confirmMsgText = '<h3 class="alert_title">{{ IMGUPLOAD_TITLE }}</h3><div class="alert_text"><p>{{ lang("IUL_CONFIRMBOX_TEXT1")|e("js") }}</p>' + imgHTMLList + '<p>{{ lang("IUL_CONFIRMBOX_TEXT2")|e("js") }}</p><input type="button" name="confirm" value="{{ lang("YES")|e("js") }}" class="button2">&nbsp;&nbsp;<input type="button" name="cancel" value="{{ lang("NO")|e("js") }}" class="button2"></div>';
461+
462+
e.preventDefault();
463+
phpbb.confirm(confirmMsgText, imcger.imgUpload.confirmSavePost, true);
464+
}
465+
});
466+
467+
/**
468+
* Callback function for confirmbox
469+
*
470+
* @param {bool} answerYes
471+
*/
472+
imcger.imgUpload.confirmSavePost = function(answerYes) {
473+
474+
if (answerYes) {
475+
$('.submit-buttons').off('click', '.button1');
476+
$('.submit-buttons [name="' + imcger.imgUpload.submitType + '"').trigger('click');
477+
}
478+
}
479+
428480
/**
429481
* Update the relevant elements and hidden data for
430482
* an attachment when page load.
@@ -497,7 +549,7 @@
497549
imgHeight = maxImgHeight / e.target.width * e.target.height;
498550
}
499551

500-
$(this).css('margin-top', ((maxImgHeight - parseInt(imgHeight)) / 2));
552+
$(e.target).css('margin-top', ((maxImgHeight - parseInt(imgHeight)) / 2));
501553
});
502554
}
503555
});
@@ -584,7 +636,7 @@
584636
imgHeight = maxImgHeight / e.target.width * e.target.height;
585637
}
586638

587-
$(this).css('margin-top', ((maxImgHeight - parseInt(imgHeight)) / 2));
639+
$(e.target).css('margin-top', ((maxImgHeight - parseInt(imgHeight)) / 2));
588640
});
589641

590642
// Update row with the image file size

imcger/imgupload/styles/prosilver/theme/imgupload.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,9 @@
5050
.imcger-iupl-button .button:hover .icon {
5151
color: #D31141;
5252
}
53+
54+
/* Post confirmbox
55+
-------------------------------------- */
56+
.alert_text ul {
57+
margin: -1em 0 1.5em 2em;
58+
}

imgupload_version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"stable": {
33
"1.0": {
4-
"current": "1.4.0",
4+
"current": "1.4.1",
55
"announcement": "https://www.phpbb.de/community/viewtopic.php?t=246009",
66
"download": "https://github.com/IMC-GER/phpBB-Image-upload-use-ImageMagick/tags",
77
"eol": null,

0 commit comments

Comments
 (0)