News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Automatic Attachment Rotation (and Resize)

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

Previous topic - Next topic

szinski

#560
Yes, the new new code works, thanks.

szinski

Also, animated GIFs are not working when I enable the plugin (only displays a static image). When I disable the plugin, animated GIFs upload and display properly.

GL700Wing

Quote from: szinski on July 09, 2024, 09:06:31 PMAlso, animated GIFs are not working when I enable the plugin (only displays a static image). When I disable the plugin, animated GIFs upload and display properly.
@szinski Okay - try this file ...
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

szinski

Quote from: GL700Wing on July 10, 2024, 12:08:56 AM
Quote from: szinski on July 09, 2024, 09:06:31 PMAlso, animated GIFs are not working when I enable the plugin (only displays a static image). When I disable the plugin, animated GIFs upload and display properly.
@szinski Okay - try this file ...
Installed the new code and it's still not showing animated GIFs. I disabled the plugin, uploaded an animated GIF, and it displays properly. Then, I re-enable the plugin and the animation no longer works.

Settings (that should matter) are:
Re-encode potentially dangerous image attachments: OFF
Reformat non-JPEG images to JPEG: OFF

szinski

Seeing the following error:

Cannot modify header information - headers already sent by (output started at /home/test/public_html/forum/Sources/Subs-AutoRotation.php:2345)

szinski

It seems to be resizing the GIFs.

GIF uploaded with plugin disabled is 243.86 KB and animates as expected.
GIF uploaded with plugin enabled is 10.73 KB and no animation.

Arantor

Is the "Use Imagick" option ticked? (And does your server have ImageMagick?)

Resizing using the GD (default) method cannot handle animated GIFs, it ends up resizing the first frame only.
Holder of controversial views, all of which my own.


szinski

Quote from: Arantor on July 10, 2024, 12:45:53 PMIs the "Use Imagick" option ticked? (And does your server have ImageMagick?)

Resizing using the GD (default) method cannot handle animated GIFs, it ends up resizing the first frame only.
Yes, Imagick is installed and working. (yes, the box is checked, which I believe isn't selectable unless it's installed)

GL700Wing

Quote from: szinski on July 10, 2024, 11:39:01 AMInstalled the new code and it's still not showing animated GIFs. I disabled the plugin, uploaded an animated GIF, and it displays properly. Then, I re-enable the plugin and the animation no longer works.

Settings (that should matter) are:
Re-encode potentially dangerous image attachments: OFF
Reformat non-JPEG images to JPEG: OFF

Just discovered that I'd forgotten to also exclude GIF images if the 'Automatically process existing images using the settings above when messages are displayed' setting is enabled - the previous version was working as I expected apart from that.  New Subs-AutoRotation.php file attached.

Quote from: szinski on July 10, 2024, 11:41:39 AMSeeing the following error:

Cannot modify header information - headers already sent by (output started at /home/test/public_html/forum/Sources/Subs-AutoRotation.php:2345)
Can't find any leading/trailing whitespace around the opening/closing PHP tags in the last Subs-AutoRotation.php file I uploaded (the most common cause of this type of error) - can't explain that error at all.
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

szinski

#569
Quote from: GL700Wing on July 10, 2024, 07:01:00 PMCan't find any leading/trailing whitespace around the opening/closing PHP tags in the last Subs-AutoRotation.php file I uploaded (the most common cause of this type of error) - can't explain that error at all.
I installed the latest Subs-AutoRotation.php and now everything seems to be working.

That crazy error was caused by a trailing newline character after the PHP closing ?> tag from where I pasted the code using VIM. I removed the trailing newline and the error is gone.

I appreciate all of your help with this!

GL700Wing

Quote from: szinski on July 11, 2024, 09:27:14 AM
Quote from: GL700Wing on July 10, 2024, 07:01:00 PMCan't find any leading/trailing whitespace around the opening/closing PHP tags in the last Subs-AutoRotation.php file I uploaded (the most common cause of this type of error) - can't explain that error at all.
I installed the latest Subs-AutoRotation.php and now everything seems to be working.

That crazy error was caused by a trailing newline character after the PHP closing ?> tag from where I pasted the code using VIM. I removed the trailing newline and the error is gone.

Great - thanks for letting me know. 

Also, and when possible, you should just overwrite the old file with the new one that is supplied by uploading it rather than using an editor to copy/paste to replace the old file contents.
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

szinski

I agree, totally my fault.

I use a Mac and it's easier to open the file in Visual Studio Code, then copy all to the clipboard, then SSH to my server, create a new file using VIM (set paste mode) and paste in the new code. Then I backup the old file, then move the new one into place. That way I can easily revert back to the old code if I see any issues. I usually remove the trailing whitespace, but I neglected to do so this time. Again, my bad. But, everything looks good now. Animated GIFs are working and my users are happy. I appreciate your help with this.

GL700Wing

#572
Quote from: szinski on July 11, 2024, 09:47:12 AMI use a Mac and it's easier to open the file in Visual Studio Code, then copy all to the clipboard, then SSH to my server ...
I use the Waterfox Classic browser with the FireFTP add-on (which supports SFTP and can use SSH keys) for file transfers to/from the web hosting servers I use.  I know the Waterfox Classic browser is no longer being updated but I don't use it for anything else except the FireFTP add-on.

QuoteI appreciate your help with this.
You're welcome.
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: