Automatic Attachment Rotation (and Resize)

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

Previous topic - Next topic

Westwegoman

I'm trying it from my iPhone today and now it's saying the file is too big, even though I am pretty sure I have the setting set large enough.

SMF version 2.1.4
Mod version 6.23

Westwegoman

So I just realized that I had it set to 2,000kb and my file was 2.1mb. I changed it to 3,000 on and then I got the error shown in the attached photo.

Aleksi "Lex" Kilpinen

500 is a server side error, check your server error log.
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

How you can help SMF

Westwegoman

Quote from: Aleksi "Lex" Kilpinen on September 01, 2023, 11:24:38 AM500 is a server side error, check your server error log.

Ok. I'll have to look into that. I just found it odd that it did it only when the mod is installed. Mod is also installed on a few other 2.0.xx forums that I have and works flawlessly.

GL700Wing

Version 6.24 - September 02, 2023
o Bug fix for some images being incorrectly resized when a message was displayed. The issue only occurred for images uploaded by a member who could choose non-default settings if all of the following conditions were met:
  - the member chose non-default settings when attaching the image(s);
  - the 'Enable different image compression and/or resizing values for some membergroups' setting was enabled; and
  - the 'Automatically process existing images using the settings above when messages are displayed' setting was enabled.


Note: There is an upgrade option for v6.20 - v6.23.
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

gevv

Hi, when uploading a gif image, its format changes to jpg. Is there a solution? (gif image size is small)

ElkArte is a modern, powerful community building forum software. https://www.elkarte.net/

Aleksi "Lex" Kilpinen

I'd assume disabling the setting "Reformat non-JPEG images to JPEG" would be worth a try.
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

How you can help SMF

gevv

Thanks. I did what you said and it was uploaded as a gif but the animation disappeared.
ElkArte is a modern, powerful community building forum software. https://www.elkarte.net/

Arantor

Then it was resized, there's no way natively in PHP to resize a GIF and not lose the animation (this requires ImageMagick which few mods support)
Holder of controversial views, all of which my own.


gevv

no resizing  gif size does not exceed the limit (1600px)
ElkArte is a modern, powerful community building forum software. https://www.elkarte.net/

Arantor

Well, it looks like it's processing it anyway even though it apparently shouldn't?
Holder of controversial views, all of which my own.


GL700Wing

I believe this is a native SMF issue (ie, not related to this mod and you can confirm this by disabling the mod) - see the following posts:
Gifs freeze after upload
Animation stops

An old forum post on GIFs as possible security risks:
How can an image be a security risk?

And some recent reports in the media of GIFs containing malicious code/malware:
Hackers can now sneak malware into the GIFs you share
Researchers Find Malware Hiding in GIFs
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

Kindred

#532
Smf does not natively force a process of gifs which are under the defined size limit.
Animated gifs work just fine in smf core
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

GL700Wing

#533
Quote from: Kindred on December 31, 2023, 05:20:21 PMSmf does not natively force a process of gift which are under the defined size limit.
Animated gift work just fine in smf core
I've confirmed two things:
1. SMF 2.1 does not resize GIFs even if they are larger than the configured maximum width/height values; and
2. There is a bug when this mod is enabled that is causing it to compress images when it shouldn't (I'll work on a fix for this as soon as I can).
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

GL700Wing

@gevv I found a bug in the main script file that was causing it to compress images even if they aren't a JPEG image or being reformatted to JPEG.

I've attached an updated script file in which I've changed the code so that now only JPEG images (or images that are being reformatted to JPEG) will be compressed and I'll include these changes in the next release of the mod.


Note: Replacing the existing ./Sources/Subs-AutoRotation.php file with the attached file will not cause package manager issues if you subsequently decide to uninstall or later upgrade the mod.  However, if you uninstall/reinstall v6.24 of the mod you will need to replace the default Subs-AutoRotation.php with the attached 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

gevv

Hi,  Thanks @GL700Wing and to everyone.

I updated the file and the problem was solved. I will heed the warning.
ElkArte is a modern, powerful community building forum software. https://www.elkarte.net/

sbartelski

I moved my (working) version of our forums to a different provider, and now get the message below when I access the File Maintenance or Resize, Rotate and/or Reformat Existing Images functions. Can you point me in the right direction to troubleshoot this? I include my Attachment Settings too.
Stefan Bartelski
Webmaster for the Cadillac LaSalle Discussion forums

sbartelski

Quote from: sbartelski on March 12, 2024, 02:20:20 PMI moved my (working) version of our forums to a different provider, and now get the message below when I access the File Maintenance or Resize, Rotate and/or Reformat Existing Images functions. Can you point me in the right direction to troubleshoot this? I include my Attachment Settings too.

Fixed. While I was waiting, I happened to dig into the new providers Knowledge Base and found a memory limit setting. There was no entry for that setting in the php settings file, so I added it, starting with the suggest value of 300M. As that is larger than the memory in the error message, I was hoping that it would work. And it did!

Call my question closed. Next time I will dig first and then ask next .
Stefan Bartelski
Webmaster for the Cadillac LaSalle Discussion forums

GL700Wing

Given this issue only started when you moved servers it seems to me that you need to increase the value for the setting The amount of server memory (in megabytes) to allocate to image rotation/resizing (eg, 128). from 24 (which is very low).

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

sbartelski

Quote from: GL700Wing on March 12, 2024, 02:37:02 PMGiven this issue only started when you moved servers it seems to me that you need to increase the value for the setting The amount of server memory (in megabytes) to allocate to image rotation/resizing (eg, 128). from 24 (which is very low).



You are probably right as I now had this error when I started the batch resize"

Fatal error: Uncaught ImagickException: invalid colormap index `/home/dh_p6nj8d/clc-smf-test.dreamhosters.com/attachments/372_275496b80036df18775e7cc514eb1787a8b8edcd.dat' @ error/colormap-private.h/ConstrainColormapIndex/35 in /home/dh_p6nj8d/clc-smf-test.dreamhosters.com/Sources/Subs-AutoRotation.php:2062 Stack trace: #0 /home/dh_p6nj8d/clc-smf-test.dreamhosters.com/Sources/Subs-AutoRotation.php(2062): Imagick->__construct('/home/dh_p6nj8d...')
#1 /home/dh_p6nj8d/clc-smf-test.dreamhosters.com/Sources/Subs-AutoRotation.php(1103): AutoRotation_Process('/home/dh_p6nj8d...', 0, '65', 'jpeg')
#2 /home/dh_p6nj8d/clc-smf-test.dreamhosters.com/Sources/Subs-ResizeExistingImages.php(163): AutoRotation_ResizeExisting(Array)
#3 /home/dh_p6nj8d/clc-smf-test.dreamhosters.com/Sources/Subs.php(6030): ResizeBatch()
#4 /home/dh_p6nj8d/clc-smf-test.dreamhosters.com/Sources/ManageAttachments.php(92): call_helper('ResizeBatch')
#5 /home/dh_p6nj8d/clc-smf-test.dreamhosters.com/Sources/Admin.php(499): ManageAttachments()
#6 /home/dh_p6nj8d/clc-smf-test.dreamhosters.com/index.php(186): AdminMain()
#7 {main} thrown in /home/dh_p6nj8d/clc-smf-test.dreamhosters.com/Sources/Subs-AutoRotation.php on line 2062
Stefan Bartelski
Webmaster for the Cadillac LaSalle Discussion forums

Advertisement: