News:

Wondering if this will always be free?  See why free is better.

Main Menu

Automatic Attachment Rotation (and Resize)

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

Previous topic - Next topic

GL700Wing

#140
Quote from: The QE2 Story Forum on April 02, 2018, 08:46:50 AM
Even though it installs and uninstalls cleanly, I'm getting issues such as zero-byte uploads, and I even have a topic that won't display now until I uninstall the mod...
With the zero-byte upload issue - what are the file size and image dimensions of the original image (eg, 7.4Mb, 4608x3456) you are trying to upload?

Have you tried running Attachments and Avatars -> File Maintenance -> Attachment Integrity Check to check for/fix any database errors?

If you disable Resize existing images when the mod is installed does the topic that won't display show correctly?  Also, what are the file size and image dimensions of the attached images (eg, 7.4Mb, 4608x3456) in that topic?

Do you have the Image Processing Memory Limit mod installed and, if so, how much memory is it configured with?
Life doesn't have to be perfect to be wonderful ...

dougiefresh

Uploaded v4.1 - March 30th, 2018
o Changed some code to avoid undefined array element errors.
o Per GL700Wing, added check to see if file size is greater than 0.




@The QE2 Story Forum:  Some code has been changed to deal with certain situations better, however, no number of changes will ever be able to fix an attachment whose size is now 0 bytes....  Maybe this version will fix the errors you're encountering....

Fat Rat

I have just installed v4.1 and now I can't access the admin area of my site (v-strom.co.uk) please help?

GL700Wing

Quote from: Fat Rat on April 02, 2018, 05:53:32 PM
I have just installed v4.1 and now I can't access the admin area of my site (v-strom.co.uk) please help?
There is a problem in the file ./Sources/Subs-AutoRotation.php - if you delete that file you'll be able to access the Admin menu again and uninstall the package.
Life doesn't have to be perfect to be wonderful ...

Fat Rat


GL700Wing

Quote from: Fat Rat on April 02, 2018, 05:53:32 PM
I have just installed v4.1 and now I can't access the admin area of my site (v-strom.co.uk) please help?
There is a problem in the file ./Sources/Subs-AutoRotation.php - fix on line 522* as follows:
Find:
$sizeLimit = !empty(($modSettings[($pm ? 'pmA' : 'a') . 'ttachmentSizeLimit']) ? $modSettings[($pm ? 'A' : 'a') . 'ttachmentSizeLimit'] * 1024 : 0;
Replace With:
$sizeLimit = !empty($modSettings[($pm ? 'pmA' : 'a') . 'ttachmentSizeLimit']) ? $modSettings[($pm ? 'A' : 'a') . 'ttachmentSizeLimit'] * 1024 : 0;



* to remove extra '(' character after '!empty'
Life doesn't have to be perfect to be wonderful ...

GL700Wing

Quote from: The QE2 Story Forum on March 18, 2018, 10:20:38 AM
Only hiccup is when you go to browse files, then rotate an image, the button at the bottom, and the confirmation, both warn you about deleting files, even though I'm only rotating them.
This issue is caused by the same confirmation message being used for both rotating/flipping images and deleting any attachment type because both actions are done through a single button.

The fix is to create two buttons - one for each action.

In ./Sources/ManageAttachments.php
Find:
'value' => '<input type="submit" name="remove_submit" class="button_submit" value="' . $txt['quickmod_delete_selected'] . '" onclick="return confirm(\'' . $txt['confirm_delete_attachments'] . '\');" />',
Replace With:
'value' => '<input type="submit" name="rotate_submit" class="button_submit" value="' . $txt['img_rotate'] . '" onclick="return confirm(\'' . $txt['img_rotate_confirm'] . '\');" />
<input type="submit" name="remove_submit" class="button_submit" value="' . $txt['quickmod_delete_selected'] . '" onclick="return confirm(\'' . $txt['confirm_delete_attachments'] . '\');" />',


Add to ./Themes/default/languages/AutoRotation.english.php
$txt['img_rotate_confirm'] = 'Are you sure you want to apply the image rotate/flip changes?';
Life doesn't have to be perfect to be wonderful ...

dougiefresh

Uploaded v4.2 - April 3rd, 2018
o Per GL700's post, fixed syntax error in Subs-AutoRotation.php.
o Per GL700's post, fixed issue where same message for rotating images as deleting images.
o Per GL700Wing, changed code to avoid "white screen of death" when rotating images manually.




@GL700Wing:  Thank you for all the changes and fixes you've sent!  They've been included in this version!

@Everybody Else:  Sorry about the delay in responding.  I've been dealing with not-fun family issues lately and haven't been able to respond....

dougiefresh

Uploaded v4.3 - April 5th, 2018
o Fixed code to avoid distorting aspect ratio of resized pictures.
o Added code to avoid resizing images if they are under/at admin-set dimensions.
o Per GL700Wing, changed required for Image Processing Memory Limit mod was made.
o Per GL700Wing, fixed issue where JPEG quality/dimensions settings are empty.




@Everybody:  Sorry, everybody!  GL700Wing and I keep finding things to fix/tweak....  Hopefully, this update solves some problems people have been experiencing....

Fat Rat

I uploaded 4.2 and didn't install because of the following errors?


Shambles

Quote from: Fat Rat
I uploaded 4.2 and didn't install because of the following errors?



Just do the changes to that file manually - there are only 4 small changes to make:

The parser on the mod download page will show you the edits you need to make to that file.

GL700Wing

Quote from: dougiefresh on April 05, 2018, 08:38:00 PM
@Everybody:  Sorry, everybody!  GL700Wing and I keep finding things to fix/tweak....  Hopefully, this update solves some problems people have been experiencing....
dougiefresh and I have been working together to implement automatic image resizing in conjunction with automatic JPEG image rotation and, having found/fixed/tweaked a few more things today, I expect the next release to be the last for a while.
Life doesn't have to be perfect to be wonderful ...

dougiefresh

#152
I've got to backport the changes to SMF 2.0 that GL700Wing made into SMF 2.1 Beta 3.  However, I've got a problem where I get this message from SMF 2.1 Beta 3 (fresh install):
Notice: Undefined index: htmlspecialchars in D:\Website\clean21\Sources\Errors.php on line 69

Fatal error: Function name must be a string in D:\Website\clean21\Sources\Errors.php on line 69

Running PHP 5.6.34....  Totally confused....  And no, I DO NOT want to run the GitHub version, as there are too many changes that can easily break my mods....  I won't support the GitHub version until it becomes the official beta 4/RC1/whatever....

Nevermind, the backup I imported in order to restore my database evidently was causing these issues....  Back to backporting.  I would guess that the new version won't be out until tomorrow, cause I have to go to work in about an hour.... (sigh)

dougiefresh

#153
Uploaded v4.4 - April 7th, 2018
o SMF 2.0: Fixed XML installer error concerning JPEG quality size.
o Per GL700Wing, added JPEQ quality check to prevent unnecessary image resizing.
o Per GL700Wing, fixed code to prevent converting to JPEG when admin option unchecked.
o Per GL700Wing, added option to disable automatic image rotation.
o Per GL700Wing, added option to disable automatic image resizing.
o Fixed a few possible undefined index array errors.




@GL700:  All changes you've made in the mod are now available in the SMF 2.1 Beta 3 version of the mod as well!  Thanks again!

dougiefresh

Uploaded v4.5 - April 8th, 2018
o NOTE: Statement in last version changelog "added option to disable automatic image rotation" was incomplete.
o Per GL700Wing, added option to disable automatic image rotation FOR EXISTING IMAGES.
o Per GL700Wing, fixed default JPEG quality value to be 100 instead of 0.
o Per GL700Wing, added mime type test prior to check for orientation.

@rjen

I am getting an error on Post.php.

It seems to me you are addressing this code looking for 4 tabs, there are only 3 in the original code...


Code: (Zoek) [Selecteer]
// Check the total upload size for this post...

Code: (Voeg toe voor) [Selecteer]
// Automatic Attachment Rotation (and Resize) alteration:
if (!empty($modSettings['attachment_auto_rotate']))
{
require_once($sourcedir . '/Subs-AutoRotation.php');
AutoRotation_Inbound($n);
}
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

@rjen

Now the next question: how does this Mod behave when this one is already active?

http://custom.simplemachines.org/mods/index.php?mod=2206

Checking the settings between my Test and my Porductive forum it seems that the code is cery similar?
Can I just deactivate the other one?
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Rob Lightbody

Quote from: @rjen on April 08, 2018, 03:42:01 PM
Now the next question: how does this Mod behave when this one is already active?

Read the compatibility notes on the first post... I fell into the same trap.

I'm currently waiting to reinstall this once it seems stable.

@rjen

Quote from: The QE2 Story Forum on April 08, 2018, 04:13:00 PM
Quote from: @rjen on April 08, 2018, 03:42:01 PM
Now the next question: how does this Mod behave when this one is already active?

Read the compatibility notes on the first post... I fell into the same trap.

I'm currently waiting to reinstall this once it seems stable.


Similar functionality ? It seems to be mostly the same code! Even the text strings are the same...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

GL700Wing

Uploaded v4.6 - April 8th, 2018
o Per @rjen's post fixed installation error in ./Sources/Post.php.
o Moved test for disabled automatic image rotation from ./Sourecs/Post.php to ./Sources/Subs-AutoRotation.php so that image resizing still occurs when automatic image rotation is disabled.
o Fixed bug in ./Sources/Subs-AutoRotation.php where image filename suffix was not being changed following reformat.
o Added redirect to 'Attachment Settings' following installation.
Life doesn't have to be perfect to be wonderful ...

Advertisement: