Advertisement:

Author Topic: Automatic Attachment Rotation (and Resize)  (Read 35173 times)

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 438
  • Gender: Female
Re: Automatic Attachment Rotation
« Reply #140 on: April 02, 2018, 03:49:54 PM »
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?
« Last Edit: April 02, 2018, 04:13:05 PM by GL700Wing »

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,753
  • Mod King
    • XPtsp.com Community
Re: Automatic Attachment Rotation
« Reply #141 on: April 02, 2018, 04:54:58 PM »
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....

Offline Fat Rat

  • Semi-Newbie
  • *
  • Posts: 37
Re: Automatic Attachment Rotation
« Reply #142 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?

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 438
  • Gender: Female
Re: Automatic Attachment Rotation
« Reply #143 on: April 02, 2018, 06:33:55 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.

Offline Fat Rat

  • Semi-Newbie
  • *
  • Posts: 37
Re: Automatic Attachment Rotation
« Reply #144 on: April 02, 2018, 06:41:23 PM »
You are a star, thank you.

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 438
  • Gender: Female
Re: Automatic Attachment Rotation
« Reply #145 on: April 02, 2018, 07:10:02 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:
Code: [Select]
$sizeLimit = !empty(($modSettings[($pm ? 'pmA' : 'a') . 'ttachmentSizeLimit']) ? $modSettings[($pm ? 'A' : 'a') . 'ttachmentSizeLimit'] * 1024 : 0;Replace With:
Code: [Select]
$sizeLimit = !empty($modSettings[($pm ? 'pmA' : 'a') . 'ttachmentSizeLimit']) ? $modSettings[($pm ? 'A' : 'a') . 'ttachmentSizeLimit'] * 1024 : 0;

* to remove extra '(' character after '!empty'

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 438
  • Gender: Female
Re: Automatic Attachment Rotation
« Reply #146 on: April 02, 2018, 10:53:42 PM »
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:
Code: [Select]
'value' => '<input type="submit" name="remove_submit" class="button_submit" value="' . $txt['quickmod_delete_selected'] . '" onclick="return confirm(\'' . $txt['confirm_delete_attachments'] . '\');" />',Replace With:
Code: [Select]
'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
Code: [Select]
$txt['img_rotate_confirm'] = 'Are you sure you want to apply the image rotate/flip changes?';

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,753
  • Mod King
    • XPtsp.com Community
Re: Automatic Attachment Rotation
« Reply #147 on: April 03, 2018, 05:46:23 PM »
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....

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,753
  • Mod King
    • XPtsp.com Community
Re: Automatic Attachment Rotation
« Reply #148 on: April 05, 2018, 08:38:00 PM »
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....

Offline Fat Rat

  • Semi-Newbie
  • *
  • Posts: 37
Re: Automatic Attachment Rotation
« Reply #149 on: April 06, 2018, 08:55:41 AM »
I uploaded 4.2 and didn't install because of the following errors?


Offline Sh@mbles

  • SMF Hero
  • ******
  • Posts: 4,912
  • Gender: Male
    • i30 Owners Club
Re: Automatic Attachment Rotation
« Reply #150 on: April 06, 2018, 09:15:43 AM »
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.

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 438
  • Gender: Female
Re: Automatic Attachment Rotation
« Reply #151 on: April 06, 2018, 09:54:22 AM »
@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.

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,753
  • Mod King
    • XPtsp.com Community
Re: Automatic Attachment Rotation
« Reply #152 on: April 06, 2018, 12:33:23 PM »
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):
Code: [Select]
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)
« Last Edit: April 06, 2018, 12:52:59 PM by dougiefresh »

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,753
  • Mod King
    • XPtsp.com Community
Re: Automatic Attachment Rotation
« Reply #153 on: April 07, 2018, 12:23:31 PM »
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!
« Last Edit: April 07, 2018, 12:45:21 PM by dougiefresh »

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,753
  • Mod King
    • XPtsp.com Community
Re: Automatic Attachment Rotation
« Reply #154 on: April 08, 2018, 11:36:19 AM »
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.

Online @rjen

  • Jr. Member
  • **
  • Posts: 265
  • Gender: Male
Re: Automatic Attachment Rotation
« Reply #155 on: April 08, 2018, 03:23:02 PM »
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: [Select]
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.0 with Tinyportal 1.6.0 at www.fjr-club.nl
Testing SMF 2.1 beta 4 with Tinyportal 1.6.0 at http://test2.fjr-club.nl/

Online @rjen

  • Jr. Member
  • **
  • Posts: 265
  • Gender: Male
Re: Automatic Attachment Rotation
« Reply #156 on: April 08, 2018, 03:42:01 PM »
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.0 with Tinyportal 1.6.0 at www.fjr-club.nl
Testing SMF 2.1 beta 4 with Tinyportal 1.6.0 at http://test2.fjr-club.nl/

Offline The QE2 Story Forum

  • Charter Member
  • Jr. Member
  • *
  • Posts: 148
    • The QE2 Story
Re: Automatic Attachment Rotation
« Reply #157 on: April 08, 2018, 04:13:00 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.

Online @rjen

  • Jr. Member
  • **
  • Posts: 265
  • Gender: Male
Re: Automatic Attachment Rotation
« Reply #158 on: April 08, 2018, 04:17:30 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.0 with Tinyportal 1.6.0 at www.fjr-club.nl
Testing SMF 2.1 beta 4 with Tinyportal 1.6.0 at http://test2.fjr-club.nl/

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 438
  • Gender: Female
Re: Automatic Attachment Rotation
« Reply #159 on: April 09, 2018, 01:22:08 AM »
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.