[3.2][3.3][RC] Attachments images rotation extension - dev/bugs logs

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Scam Warning
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
User avatar
axe70
Registered User
Posts: 751
Joined: Sun Nov 17, 2002 10:55 am
Location: Italy
Name: Alessio

[3.2][3.3][RC] Attachments images rotation extension - dev/bugs logs

Post by axe70 »

Development questions and bugs report

Attachments images rotation extension original post.
The extension release at date of this post is 1.0.3.

You can find it on github until not validated:
phpBB-image-attachments-rotation on github
on the how to section there is a link to older versions.
Last edited by axe70 on Fri Oct 02, 2020 10:32 pm, edited 1 time in total.
Do not take me too serious
Anyway i do not like Discourse
User avatar
axe70
Registered User
Posts: 751
Joined: Sun Nov 17, 2002 10:55 am
Location: Italy
Name: Alessio

Re: [3.2][3.3][RC] Attachments images rotation extension - dev/bugs logs

Post by axe70 »

I have installed 1.0.3 with phpbb 3.3.1 under php 7.3 and have a problem.
I can activate the ext. properly and when loading an ipg photo, I can see the small icon for rotation in the attachement list.
Clicking on the icon opens the black window with the photo.
However there is no reaction when I click at the photo. Nothing happens when I click on save. No way to close that window.
The black window only disappears when I open another topic.
Any idea?
Have you a test online of the problem, or it is possible for you to check the browser console, and see what kind of error it report?
It seem (maybe) a javascript error based on how you describe it

P.s: did you deleted old ext data deactivating it, before to overwrite files, and then re-activate? Just in case, disable, delete data and re-enable.
And did you recompiled stale template?
Do not take me too serious
Anyway i do not like Discourse
User avatar
HaioPaio
Registered User
Posts: 265
Joined: Mon Jan 08, 2018 7:39 pm

Re: [3.2][3.3][RC] Attachments images rotation extension - dev/bugs logs

Post by HaioPaio »

Thank you very much for your help.

axe70 wrote: Fri Oct 02, 2020 10:15 pm Have you a test online of the problem
I will send you login data for the testforum in a minute.
axe70 wrote: Fri Oct 02, 2020 10:15 pm is possible for you to check the browser console,

Code: Select all

I opened the console in Chrome and got:
[code]Uncaught ReferenceError: Cannot access 'w3Delta' before initialization
    at w3rotateByDeg (file.php?mode=rImg&id=24552:10)
    at HTMLImageElement.onclick (file.php?mode=rImg&id=24552:113)
file.php?mode=rImg&id=24552:10 Uncaught ReferenceError: Cannot access 'w3Delta' before initialization
    at w3rotateByDeg (file.php?mode=rImg&id=24552:10)
    at HTMLImageElement.onclick (file.php?mode=rImg&id=24552:113)
w3rotateByDeg @ file.php?mode=rImg&id=24552:10
onclick @ file.php?mode=rImg&id=24552:113
file.php?mode=rImg&id=24552:20 Uncaught ReferenceError: Cannot access 'countW3' before initialization
    at w3sendThis (file.php?mode=rImg&id=24552:20)
    at HTMLButtonElement.onclick (file.php?mode=rImg&id=24552:114)
w3sendThis @ file.php?mode=rImg&id=24552:20
onclick @ file.php?mode=rImg&id=24552:114
[/code]
axe70 wrote: Fri Oct 02, 2020 10:15 pm did you deleted old ext data deactivating it, before to overwrite files, and then re-activate?
Yes, this has been done
axe70 wrote: Fri Oct 02, 2020 10:15 pm did you recompiled stale template?
Yes, I enabled recompile, tried the extension without success and disabled it again.
Let me know if I should enable it again.
www.der-räuchertreff.de phpBB 3.3.x php 7.4
User avatar
axe70
Registered User
Posts: 751
Joined: Sun Nov 17, 2002 10:55 am
Location: Italy
Name: Alessio

Re: [3.2][3.3][RC] Attachments images rotation extension - dev/bugs logs

Post by axe70 »

i've see that on the site, the js document.domain isn't set properly for some reason, since it is pulled directly from phpBB config ... and yes, the problem is maybe that if in phpBB acp, where option
Cookie domain:
it is leaved blank, this cause the problem?

So i suggested to resolve on fly by doing this:

open:
/ext/w3all/imageattachrotation/language/en/common.php
and replace:
'W3IMAGEROTATION_PHPBBCOOKIEDOMAIN' => $config['cookie_domain'],
with:
'W3IMAGEROTATION_PHPBBCOOKIEDOMAIN' => 'fc4.der-räuchermysite.de',

But if what said above is true, then it is better to resolve, adding correct value for the
ACP -> Security settings -> Cookie domain:
setting, and avoid to edit the file

let know!
Do not take me too serious
Anyway i do not like Discourse
User avatar
HaioPaio
Registered User
Posts: 265
Joined: Mon Jan 08, 2018 7:39 pm

Re: [3.2][3.3][RC] Attachments images rotation extension - dev/bugs logs

Post by HaioPaio »

Success!!!
My cookie domain was empty, as suggested by phpbb for cases when an admin is not sure about cookie settings.
Now, after setting the cookie domain and recompiling styles (and setting to off thereafter) it works as expected.

I am afraid that many boards have the cookie domain empty. It would be helpful if your extension could handle such cases.
Can your extension check if the cookie domain is empty, and use the domain which was opened by the browser instead?

I like the extension very much. I try to educate our members not to use portrait mode photos from smartphones.
Now, the members can fix their rotation problems by themselves. This should help in motivating them not to use portrait mode photos.
However, it does not prevent them from doing it.

A fully automatic solution seems to be complicated due to the various combinations of possible cases.
For the time being, your solution is the best solution available.
www.der-räuchertreff.de phpBB 3.3.x php 7.4
User avatar
axe70
Registered User
Posts: 751
Joined: Sun Nov 17, 2002 10:55 am
Location: Italy
Name: Alessio

Re: [3.2][3.3][RC] Attachments images rotation extension - dev/bugs logs

Post by axe70 »

Hi! The hint has been added into github readme:
https://github.com/axew3/phpBB-image-at ... kie-domain
I am afraid that many boards have the cookie domain empty. It would be helpful if your extension could handle such cases.
Can your extension check if the cookie domain is empty, and use the domain which was opened by the browser instead?
Nice question.
Yes it can be automatically extracted. So this aspect will be covered asap with some other improvement (less code, faster execution)
Do not take me too serious
Anyway i do not like Discourse
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 28934
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier

Re: [3.2][3.3][RC] Attachments images rotation extension - dev/bugs logs

Post by Paul »

HaioPaio wrote: Sun Oct 04, 2020 9:06 am Success!!!
My cookie domain was empty, as suggested by phpbb for cases when an admin is not sure about cookie settings.
Your cookie domain really shouldn't be empty, that is a incorrect configuration, and might even cause issues with sessions not being working correctly.
User avatar
HaioPaio
Registered User
Posts: 265
Joined: Mon Jan 08, 2018 7:39 pm

Re: [3.2][3.3][RC] Attachments images rotation extension - dev/bugs logs

Post by HaioPaio »

Paul
I tend to agree.
However, in this case the phpbb 3.3.1 note in ACP is misleading
In most cases the cookie domain is optional. Leave it blank if you are unsure.
Would you agree?
Bildschirmfoto 2020-10-04 um 12.59.36.jpg
You do not have the required permissions to view the files attached to this post.
www.der-räuchertreff.de phpBB 3.3.x php 7.4
User avatar
HaioPaio
Registered User
Posts: 265
Joined: Mon Jan 08, 2018 7:39 pm

Re: [3.2][3.3][RC] Attachments images rotation extension - dev/bugs logs

Post by HaioPaio »

In most cases the cookie domain is optional. Leave it blank if you are unsure.
English is my second language. Are you sure the I misinterpret?
www.der-räuchertreff.de phpBB 3.3.x php 7.4
User avatar
Raul [ThE KuKa]
Style Customisations
Style Customisations
Posts: 11138
Joined: Mon Dec 08, 2003 9:24 pm
Location: Spain
Name: Raul Arroyo

Re: [3.2][3.3][RC] Attachments images rotation extension - dev/bugs logs

Post by Raul [ThE KuKa] »

Don't leave that field blank.
Fixing incorrect cookie settings
All unsolicited PMs will be ignored.
:warning: Knowledge Base | Documentation | Board rules | phpBB Styles Rules & Policies | Styles Queue Stats :warning:


If you like my styles, translations, etc. and want to show some appreciation, then feel free to Donate.
:flag_es: phpBB Spain - Online Since 2003 :heart:


User avatar
HaioPaio
Registered User
Posts: 265
Joined: Mon Jan 08, 2018 7:39 pm

Re: [3.2][3.3][RC] Attachments images rotation extension - dev/bugs logs

Post by HaioPaio »

We should not continue the cookie discussion here, because it deviates from the topic too far.
It is noted that the extension here currently does not work with an empty cookie domain.
www.der-räuchertreff.de phpBB 3.3.x php 7.4
User avatar
axe70
Registered User
Posts: 751
Joined: Sun Nov 17, 2002 10:55 am
Location: Italy
Name: Alessio

Re: [3.2][3.3][RC] Attachments images rotation extension - dev/bugs logs

Post by axe70 »

Thank for observations about sessions, useful for what i'm doing elsewhere, finalizing the integration plugin 2.4.0 that will be a new way to fully integrate phpBB and WordPress. Most of the old code has been rewritten, and the concept improved, it will be faster, and fixing many aspects (yes ... and this smell of adv!)

The hint about cookie domain has been added into the github readme:
https://github.com/axew3/phpBB-image-at ... kie-domain

By the way, before to start with the other code, i had a browser's tab opened into my localhost, then before to close it, since it was a test where this rotate image ext code run, i've try to click into edit post button, where in the while, the session of the user expired (that was a not remember me login) so on console it return this:
Uncaught TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type 'Node'.
at posting.php?mode=edit&f=2&p=6:347
(anonymous) @ posting.php?mode=edit&f=2&p=6:347
this because, when the request is like this
https://subdomain.localhost/phpbb3/posting.php?mode=edit&f=2&p=6
it is passed by the way, even if the user is not logged in (and then the login form appear).

It was not leading to any trouble, and coming out only in this case.
Anyway, to fix it, and run the code effectively only when needed, this code into file
phpBB-image-attachments-rotation/w3all/imageattachrotation/styles/prosilver/template/event/overall_footer_body_after.html

Code: Select all

// Only if in 'posting, edit or reply mode'
var w3ReqMode = "{{ lang('W3IMAGEROTATION_REQMODE') }}";

if( w3ReqMode == 'edit' || w3ReqMode == 'post' || w3ReqMode == 'reply' ){
has been changed into this:

Code: Select all

// Only if in 'posting, edit or reply mode' and the user is logged in
var w3ReqMode = "{{ lang('W3IMAGEROTATION_REQMODE') }}";
var w3_u_logged = "{S_USER_LOGGED_IN}";
if( w3_u_logged > 0 && w3ReqMode == 'edit' || w3_u_logged > 0 && w3ReqMode == 'post' || w3_u_logged > 0 && w3ReqMode == 'reply' ){
https://github.com/axew3/phpBB-image-at ... after.html

may was better to do:
if( w3_u_logged > 0){
then all the subsequent, but it can be acceptable also this way

p.s again: this lead me to think: phpBB allow to edit posts to a guest? It is possible to setup this way phpBB permissions?
If yes, then this code should be little improved to accomplish, because this way, the whole code run only for logged in users!

p.s ... what stupid assertion my last here ...
phpBB allow to edit posts to a guest? It is possible to setup this way phpBB permissions?
If yes, then this code should be little improved to accomplish, because this way, the whole code run only for logged in users!
i assume, that it is not possible!? by the way, i will check :)
Do not take me too serious
Anyway i do not like Discourse
User avatar
axe70
Registered User
Posts: 751
Joined: Sun Nov 17, 2002 10:55 am
Location: Italy
Name: Alessio

Re: [3.2][3.3][RC] Attachments images rotation extension - dev/bugs logs

Post by axe70 »

I log things here on fly, so i can return over if something to be fixed forgotten:

since guests can be allowed to attach on posts (and it seem to me they are not allowed to edit), then the previous assumption and code addition is wrong. Guests can't be excluded.
The code has been reverted to the previous, and all fixes applied into next 1.0.4dev (when tested before)
Do not take me too serious
Anyway i do not like Discourse
User avatar
axe70
Registered User
Posts: 751
Joined: Sun Nov 17, 2002 10:55 am
Location: Italy
Name: Alessio

Re: [3.2][3.3][RC] Attachments images rotation extension - dev/bugs logs

Post by axe70 »

Nothing...before to start with something else i had the rush to finish this so, the solution to all, has been obviously, this

Code: Select all

const w3observer = new MutationObserver(w3callback);
w3observer.observe(w3targetNode, w3config);
changed into:

Code: Select all

if( w3targetNode !== null ){
 const w3observer = new MutationObserver(w3callback);
 w3observer.observe(w3targetNode, w3config);
}
Now it seem to be perfect. The problem was not caused by the fact the user was logged in or not, but by the fact that the passed element object, if out of the contest (so post, edit or reply mode) return null.

any other assumption i did was wrong, since the simply code, just run or not, based on the fact: is the group allowed to attach?
if yes, the rotation will work for them, if not, will not work, because the attachments panel, do not exist on page for them.
And with the above little fix, any possible js error correctly prevented.
Do not take me too serious
Anyway i do not like Discourse
Holger
Registered User
Posts: 1893
Joined: Tue Mar 12, 2002 3:54 pm
Location: Hannover

Re: [3.2][3.3][RC] Attachments images rotation extension - dev/bugs logs

Post by Holger »

Thank you for this great extension!

The "rotate"-icon is VERY tiny! How can the icon be made larger?
And: could you please try to align the pop-up to the prosilver look and feel?

Keep up the good work!

Return to “Extensions in Development”