News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Automatic Attachment Rotation (and Resize)

Started by dougiefresh, March 04, 2016, 07:34:59 PM

Previous topic - Next topic

dougiefresh

Uploaded v3.7 - September 12th, 2017
o Resolved conflict with Post and PM Inline Attachments.  No functionality change.




@aegersz:  This update should take care of the conflict that you reported.

aegersz

so it does ! thanks again, dougie !
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

aegersz

whoops, the mod broke my forum and i had made a bunch of changes. I only suspected this because ./Sources/Display.php got modified ...

see https://www.simplemachines.org/community/index.php?topic=556162
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

dougiefresh

Uploaded v3.7.1 - September 12th, 2017
o SMF 2.0: Fixed a syntax typo in Sources/Display.php
o SMF 2.1: Fixed a syntax typo in Sources/Subs-Attachments.php




@aegersz:  I swear I'll get this right....  Might not be today, but I'll get it right....  O:)

aegersz

the art of programming is the practise of bugging.

I totally forgot that I put this mod back on and then went away,  uninstalled another mod by making manual code changes, ugraded 2 more of your mods and forgot to enable php logging  :(

I spent hours trying to get my site to work ... this was the first time I ever put a mod on (this one) without testing first ... it's not your fault, I didn't follow protocol and your handy auto-refresh mod delete mod sent me on a tidy-up frenzy. love that guy !
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

aegersz

It's me again - i have been busy ensuring that i am running your latest releases but when i installed this on my test system, i got this error:

Parse error: syntax error, unexpected ';', expecting ')' in /var/www/html/Sources/Display.php on line 1665

so i suggest to replace:
'href' => $scripturl . '?action=dlattach . ';ts=' . $time . ';topic=' . $msg_topic . '.0;attach=' . $attachment['id_attach'],

with:
'href' => $scripturl . '?action=dlattach;ts=' . $time . ';topic=' . $msg_topic . '.0;attach=' . $attachment['id_attach'],

is this right or have i just missed something ? it works on my test system now but it's your code ...
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

dougiefresh

Uploaded v3.8 - October 9th, 2017
o Fixed syntax error in code that builds the attachment link.




@aegersz:  Thank you for reporting the bug!  It's been fixed for this version.

landyvlad

What is the update process please?  Is it just upload and install the new one, or do I uninstall./delete the old one first?
(It'd be cool if this info was included in the description of the mod, for easy reference)

Thanks
"Put as much effort into your question as you'd expect someone to give in an answer"

Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Be the person your dog thinks you are.

dougiefresh

Quote from: landyvlad on December 18, 2017, 07:31:17 AM
What is the update process please?  Is it just upload and install the new one, or do I uninstall./delete the old one first?
(It'd be cool if this info was included in the description of the mod, for easy reference)
First, Package Manager won't allow you to install a newer version of a mod while an older version is installed.  If the package supports upgrading, Package Manager will give you the option to upgrade to the new version.  Most of my mods do not support upgrades in that fashion, mostly because some servers have issues with multiple install XML files and aren't smart enough to make it work....

The proper way to upgrade any mod that doesn't give the option through Package Manager is to uninstall the current version of the mod, then install  the new version.  Immediately deleting the old version is not mandatory at any stage of the upgrade process, although if you are happy with the new version, deletion of the old version is recommended.

@rjen

I am getting this error when testing the MOD.

This error pops up when I rotate an attached impage when editing the post...
Is it just me?

https://test.fjr-club.nl/index.php?action=post2;start=0;msg=300786;df4bebae3674=18d5e877907afa4d5c23988966f6f164;board=26
8: A non well formed numeric value encountered
Bestand: /home/deb77453/domains/fjr-club.nl/public_html/test/Sources/Subs-AutoRotation.php
Regel: 90
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

@rjen

Another question: I am mainly looking at the function to rotate attachments manually from the post area.
Since I re-encode all attachments in the forum, the automatic rotation does not seem to work upon upload (is that correct?)

Then when I am in the post area the options for rotation seem a bit 'many' for my users and a bit confusing.
Question 1:
Rotation says 'Clockwise', but when I rotate 90 degrees it actually rotates counter-clockwise (!)

Question 2:
Is there a way to sort the options provided differently?

Quote'No Change';
'Horizontal Flip';
'Rotate 180 deg Clockwise';
'Vertical Flip';
'Vertical Flip, Rotate 270 deg Clockwise';
'Rotate 270 deg Clockwise';
'Horizontal Flip, Rotate 270 deg Clockwise';
'Rotate 90 deg Clockwise';

For my users the rotate options are the most used, and actually those are throughout the list...
I want to present it like this:

Quote'No Change';
'Rotate 90 deg Clockwise';
'Rotate 180 deg Clockwise';
'Rotate 270 deg Clockwise';
'Horizontal Flip';
'Vertical Flip';
'Horizontal Flip, Rotate 270 deg Clockwise';
'Vertical Flip, Rotate 270 deg Clockwise';
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

@rjen

Quote from: @rjen on December 30, 2017, 06:35:39 AM
I am getting this error when testing the MOD.

This error pops up when I rotate an attached impage when editing the post...
Is it just me?

https://test.fjr-club.nl/index.php?action=post2;start=0;msg=300786;df4bebae3674=18d5e877907afa4d5c23988966f6f164;board=26
8: A non well formed numeric value encountered
Bestand: /home/deb77453/domains/fjr-club.nl/public_html/test/Sources/Subs-AutoRotation.php
Regel: 90

I just checked the code, and I see it is in the memory limit.

Now I am using this MOD to set a memory limit. Is there a conflict perhaps?
http://custom.simplemachines.org/mods/index.php?mod=4111
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

landyvlad

Bit of a problem.

Trying to uninstall v 3.3 to update to 3.8

The uninstall test shows the following error.

1.   Replace   ./Sources/Post.php   Test failed
2.   Replace   ./Sources/Post.php   Test successful
3.   Replace   ./Sources/Post.php   Test successful


Suggestions / help welcomed. :)
"Put as much effort into your question as you'd expect someone to give in an answer"

Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Be the person your dog thinks you are.

landyvlad

dougiefresh  - should I

1. Uninstall, ignoring the errors, or
2 Just install the new one over the top, or
3 Something else ?
"Put as much effort into your question as you'd expect someone to give in an answer"

Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Be the person your dog thinks you are.

GL700Wing

Quote from: @rjen on December 30, 2017, 08:00:06 AM
Quote from: @rjen on December 30, 2017, 06:35:39 AM
I am getting this error when testing the MOD.

This error pops up when I rotate an attached impage when editing the post...
Is it just me?

https://test.fjr-club.nl/index.php?action=post2;start=0;msg=300786;df4bebae3674=18d5e877907afa4d5c23988966f6f164;board=26
8: A non well formed numeric value encountered
Bestand: /home/deb77453/domains/fjr-club.nl/public_html/test/Sources/Subs-AutoRotation.php
Regel: 90

I just checked the code, and I see it is in the memory limit.

Now I am using this MOD to set a memory limit. Is there a conflict perhaps?
http://custom.simplemachines.org/mods/index.php?mod=4111
I'm getting the same error message and I've confirmed it is a PHP 7.x issue (eg, earlier versions of PHP weren't as pedantic) and is not caused by a conflict with any other mods.

Line 89 of ./Sources/Subs-AutoRotation.php has the following code:
$memoryLimit = ini_get('memory_limit');
and '$memoryLimit' is the value of memory_limit in your php.ini file (eg, 256M).

PHP 7.x doesn't like that '$memoryLimit' contains a non-numeric character (ie, the letter 'M') and that's why it's complaining when it is used in the calculation on line 90:
$memoryRequested = (int) $memoryLimit + ceil(($currentMemory - $memoryLimit * pow(1024, 2)) / pow(1024, 2));

The fix is to change line 89 of ./Sources/Subs-AutoRotation.php to use the PHP '(float)' function to remove non-numeric characters from memory_limit in php.ini when it becomes '$memoryLimit' (eg, 256 will be returned).
$memoryLimit = (float) ini_get('memory_limit');

Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

dougiefresh

Quote from: landyvlad on January 17, 2018, 05:10:39 AM
Bit of a problem.

Trying to uninstall v 3.3 to update to 3.8

The uninstall test shows the following error.

1.   Replace   ./Sources/Post.php   Test failed
2.   Replace   ./Sources/Post.php   Test successful
3.   Replace   ./Sources/Post.php   Test successful


Suggestions / help welcomed. :)
Attach your Sources/Post.php and I'll try to help you.  Don't and I simply can't....




@GL700Wing:  Will this fix work with PHP 5.x, though?  Cause I'll be happy to implement it, but I need to know if it'll cause issues for PHP 5.x.....

GL700Wing

Quote from: dougiefresh on January 21, 2018, 08:27:51 PM@GL700Wing:  Will this fix work with PHP 5.x, though?  Cause I'll be happy to implement it, but I need to know if it'll cause issues for PHP 5.x.....
Don't know - my main websites are PHP 7.x (and I can't set the version of PHP to be different on a per-forum basis within a website) but I do have one website where I can setup a PHP 5.x forum - will try and get time tonight to try it and let you know.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

landyvlad

dougiefresh when I'm next at a computer that will allow me to download and upload such files (e.g at home), I will do so.
"Put as much effort into your question as you'd expect someone to give in an answer"

Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Be the person your dog thinks you are.

landyvlad

It's OK success !@
I uninstalled it and then found the one edit that the uninstaller could not do, manually edited that out.
Installed new version.  All good !

Thanks.
"Put as much effort into your question as you'd expect someone to give in an answer"

Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Be the person your dog thinks you are.

GL700Wing

Quote from: GL700Wing on January 22, 2018, 12:42:43 AM
Quote from: dougiefresh on January 21, 2018, 08:27:51 PM@GL700Wing:  Will this fix work with PHP 5.x, though?  Cause I'll be happy to implement it, but I need to know if it'll cause issues for PHP 5.x.....
Don't know - my main websites are PHP 7.x (and I can't set the version of PHP to be different on a per-forum basis within a website) but I do have one website where I can setup a PHP 5.x forum - will try and get time tonight to try it and let you know.
Hmm - I typed a reply to this last night but it's not here - it was very late so might have forgotten to click the 'Post' button.

I tested the '(float)' fix with SMF 2.0.15 and PHP 5.6 and, in addition to rotating the images, it did not cause any errors to be logged (no other mods were installed on the forum I tested it on).
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Advertisement: