Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: dougiefresh on March 04, 2016, 07:34:59 PM

Title: Automatic Attachment Rotation (and Resize)
Post by: dougiefresh on March 04, 2016, 07:34:59 PM
Link to Mod (https://custom.simplemachines.org/mods/index.php?mod=4087)


AUTOMATIC ATTACHMENT ROTATION (AND RESIZE) v5.6
By Dougiefresh (http://www.simplemachines.org/community/index.php?action=profile;u=253913) -> Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=4087)


Introduction
This mod allows the automatic rotation and/or flipping of images ONLY IF the EXIF information contained within (if such exists) indicates that such processing is required in order to show the picture  in the correct orientation.

NOTE: SMF contains an option called Re-encode potentially dangerous image attachments, which is turned on by default.  This re-encoding removes the orientation information from attachments (amongst other things), which means attachments uploaded prior to this mod being installed will NOT be able to rotated properly, as the EXIF information is missing from the re-encoded attachment file!

Major changes introduced in v4.0
o Option to enable/disable automatic image rotation.
o Code update to enable automatic image resizing/reformatting in posts (and PMs if the PM Attachments (https://custom.simplemachines.org/mods/index.php?mod=1974) mod is installed).

Major change introduced in v5.0
o Option to automatically, manually or batch resize/reformat existing images using 'Attachment Settings' options (non-JPEG images will only be reformatted to JPEG if the Reformat non-JPEG images to JPEG option is enabled).


Post Screen Changes
Beside each image attachment a dropbox will be displayed listing the following rotation options:
o No Change
o Rotate 90o Right
o Rotate 90o Left
o Rotate 180o
o Horizontal Flip
o Vertical Flip
o Horizontal Flip, Rotate 90o Right
o Vertical Flip, Rotate 90o Right


Automatic Resizing of Existing Images
When a post is dispayed, and if the Attachment Setting Resize existing images option is enabled, images in the post will be automatically resized (and reformatted to JPEG if the Attachment Setting option Reformat non-JPEG images to JPEG is enabled) using the same Attachment Setting options (ie, Reformat non-JPEG images to JPEG, JPEG quality factor and/or maximum width/height) that are applied to new image attachments in posts.  In addition, if the Attachment Setting option Create backup of original image file when resizing is also enabled the original image file will be saved to the attachments directiory with the extension '.rei'.


Manual Resizing of Existing Images
This feature, which can be accessed via Admin => Forum => Attachments and Avatars => Browse Files => Resize Existing Images, can be used to selectively resize/reformat existing images using the same Attachment Setting options (ie, Reformat non-JPEG images to JPEG, JPEG quality factor and/or maximum width/height) that are applied to new image attachments in posts.


Batch Resizing of Existing Images
This feature, which can be accessed via Admin => Forum => Attachments and Avatars => File Maintenance => Batch Resize Existing Images, will resize/reformat all existing images using the same Attachment Setting options (ie, Reformat non-JPEG images to JPEG, JPEG quality factor and/or maximum width/height) that are applied to new image attachments in posts.
 
The forum should be configured as follows prior to commencing batch resizing:
o Admin => Configuration => Server Settings => General => Enable Maintenance Mode should be enabled.
o Admin => Configuration => Security and Moderation => General => Disable administration security should be disabled.
o Admin => Forum => Posts and Topics => Topic Settings => Number of posts per page in a topic page should be configured to between 15 and 25 via  (make a note of the current value).
o Admin => Forum => Attachments and Avatars => Attachment Settings - Maximum size per attachment, Reformat non-JPEG images to JPEG, JPEG quality factor, Maximum width of attached images and Maximum height of attached images should be configured.
o Admin => Forum => Attachments and Avatars => File Maintenance => Attachment Integrity Check should be run and issues corrected.

Important notes for batch resizing:
o Non-JPEG images will only be reformatted to JPEG if the Reformat non-JPEG images to JPEG option is enabled.
o Existing 'attachments' database table will be copied to 'attachmentsPreREI' database table. *
o Original image files are saved to the 'attachmentsPreREI' directory/folder. *
o File timestamp for resized image file is set to match timestamp of original image file.
o Batch processing progress information is displayed and updated.
o The results of the batch resizing process will be displayed on completion and also written to the forum error log file.

* The 'attachmentsPreREI' database table and directory/folder can be removed after checks have been done to confirm successful resizing - this will free up additional disk space on the server.

The forum should be configured as follows after batch resizing has finished:
o Admin => Configuration => Security and Moderation => General => Disable administration security should be enabled.
o Admin => Configuration => Server Settings => General => Enable Maintenance Mode should be disabled.
o Admin => Forum => Posts and Topics => Topic Settings => Number of posts per page in a topic page should be configured to previous value.


Admin Changes
In Admin => Forum => Attachments and Avatars:
o Browse Files: There is a new column (and associated button) for rotating/flipping images - the options for rotating/flipping images are only shown for image attachments.  There is also a new horizontal tab labelled 'Resize Existing Images' that can be used for manually resizing/reformatting existing images.
o Attachment Settings: Options to enable/disable automatic image rotation and automatic resizing of existing images, option to reformat non-JPEG images to JPEG and options to set JPEG quality factor and max width/height values for attached images.
o File Maintenance: There is a new section for Batch Resize Existing Images.  There is also a new section for Reset Orientation Flag.


Compatibility Notes
This mod was tested on SMF 2.0.15 but should work on SMF 2.0 and up.
It has also been tested on SMF 2.1 Beta 3 and there are some known issues with manual image rotation not always working and with the manual image rotation options not being displayed in posts.
This mod is not currently compatible with SMF 2.1 Beta 4.
SMF 1.x is not and will not be supported.

The Image Processing Memory Limit (https://custom.simplemachines.org/mods/index.php?mod=4111) mod should be installed if 'white screen' issues are encountered when uploading and/or rotating images.

The Improved Attachment Error Handling (https://custom.simplemachines.org/mods/index.php?mod=3255) mod (if so desired) should be installed BEFORE this mod to avoid install errors.

The Resize Attachment Images (https://custom.simplemachines.org/mods/index.php?mod=2206) mod MUST be uninstalled prior to installing this version as the two mods are not compatible (this mod contains similar and updated functionality).


Translators
o Dutch: @rjen (https://www.simplemachines.org/community/index.php?action=profile;u=287786)
o Spanish Latin: Rock Lee (https://www.simplemachines.org/community/index.php?action=profile;u=322597).


Special Credit
This mod relies on the phpExifRW (http://www.phpclasses.org/package/1042-PHP-EXIF-information-reader-and-writer.html) class, which is licensed under the GNU Lesser General Public License (http://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html), in order to read the EXIF information from image files.  This class makes the requirement of having EXIF support built-in, which some servers do not have, not important to the task of successfully pulling the orientation out of the image file.  The exifReader.inc file was renamed to Class-exifReader.php in order to name the file in accordance with the naming convention of SMF and included in this mod.

Test images with EXIF orientation values embedded in them are available at Galloway.me.uk (http://www.galloway.me.uk/2012/01/uiimageorientation-exif-orientation-sample-images/) and at the  Image Orientation (http://www.elkarte.net/community/index.php?topic=2509.0) thread over at the ElkArte forum.


Changelog
The changelog has been removed and can be seen at XPtsp.com (http://www.xptsp.com/board/index.php?topic=662.msg975#msg975).


License
Quote
Copyright (c) 2016 - 2018, Douglas Orend
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on March 13, 2016, 08:30:35 PM
Bug report and response to said bug report:
@Dougiefresh

Your mod did not turn the tumbnail in my forum!!

/Dan
I read this statement again just now and I think I understand what is going on.  My mod only deals with rotating NEW attachments, pre-existing attachments are not touched....  If you are looking for functionality to deal with existing attachments, then I can add that into the mod as well.  However, such image processing is quite intensive and possibly time consuming for forums with a large number of attachments.....

Rereading the mod description, it also sounds like I need to clarify the purpose of the mod.....  ???

I would also advise you to post problems regarding specific mods into the support thread of that mod, which in this case is located here (http://www.simplemachines.org/community/index.php?topic=544111.0).....  It is by chance that I can across this particular bug report, and I don't look everywhere for threads regarding my 51 approved mods....  O:) :P

I've quoted these messages and placed them in the right thread for you, to make it easier for me to locate...  O:) :P
Title: Re: Automatic Attachment Rotation
Post by: FrizzleFried on March 14, 2016, 05:59:17 PM
Not working... maybe the mod doesn't work with inline attachment mod?

Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on March 14, 2016, 06:04:17 PM
@Everybody: Regarding bug report two posts ago, I am attempting to rewrite the mod so that it also works for existing attachments.  Version 1.0 only works for NEW attachments (at least it worked during my testing....)

Not working... maybe the mod doesn't work with inline attachment mod?
Honestly, I don't know if it will work with the inline attachment mod.  Hasn't been tested....
Title: Re: Automatic Attachment Rotation
Post by: FrizzleFried on March 14, 2016, 06:39:47 PM
I assume I don't need to turn anything on?

How I am testing is that I am uploading an image that shows rotated on my digital camera... it also shows rotated (vertical orientation) in windows explorer... but when I upload it it appears horizontal (should be vertical).   It's remaining horizontal... I've tried both having the image appear "in-line" as well as a standard upload with no in-line adjustments made... and both show up horizontal.

Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on March 15, 2016, 07:28:39 PM
Uploaded v1.1 - March 14th, 2016
o Fixed several errors within the image_rotate_flip function.
o Added code to rotate/flip attachments upon download if they haven't been processed yet.
o Added code to rotate/flip attachments upon displaying topics if they haven't been processed yet.
o Branched image_rotate_flip function as AutoRotation_Process into Subs-AutoRotation.php file.
o Seperated SMF 2.0.x and SMF 2.1 install branches.



@FrizzleFried and dan4ever: Hopefully this update takes care of the problems you experienced in version 1.0....  Please note while the mod will attempt to fix the orientation on pre-existing attachments, the orientation information may already be removed due to forum processing of the image attachment prior to this mod's installation....
Title: Re: Automatic Attachment Rotation
Post by: dan4ever on March 20, 2016, 08:43:10 PM
No, still not working.
And I got alot of this error:

Quote
http://www.guldforum.se/forum/index.php?topic=3302.msg29328 (http://www.guldforum.se/forum/index.php?topic=3302.msg29328)
The database value you're trying to insert does not exist: width
Function: AutoRotation_Update
Fil: /storage/content/******/guldforum.se/public_html/forum/Sources/Subs-AutoRotation.php
Rad: 207



If you are looking for functionality to deal with existing attachments, then I can add that into the mod as well. 
YES, PLEASE!!!!!!!

/Dan
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on March 21, 2016, 07:12:41 PM
No, still not working.
And I got alot of this error:

Quote
http://www.guldforum.se/forum/index.php?topic=3302.msg29328 (http://www.guldforum.se/forum/index.php?topic=3302.msg29328)
The database value you're trying to insert does not exist: width
Function: AutoRotation_Update
Fil: /storage/content/******/guldforum.se/public_html/forum/Sources/Subs-AutoRotation.php
Rad: 207
Damn, that looks familiar.....  I thought I took care of that error message...  (Big sigh)  Let me look into it again....

If you are looking for functionality to deal with existing attachments, then I can add that into the mod as well. 
YES, PLEASE!!!!!!!
I've attempted to add functionality to deal with existing attachments in version 1.1.  It seems that SMF's re-encoding process strips out the EXIF information from the images, so it CAN'T automatically rotate and/or flip the image(s) accordingly.....  So I'm at a loss on how to proceed with those instances....

I guess I could add something in the Profile -> Show Posts -> Attachments screen....  I just don't know what at this moment....
Title: Re: Automatic Attachment Rotation
Post by: dan4ever on March 22, 2016, 09:29:28 AM
No, still not working.
And I got alot of this error:

Quote
http://www.guldforum.se/forum/index.php?topic=3302.msg29328 (http://www.guldforum.se/forum/index.php?topic=3302.msg29328)
The database value you're trying to insert does not exist: width
Function: AutoRotation_Update
Fil: /storage/content/******/guldforum.se/public_html/forum/Sources/Subs-AutoRotation.php
Rad: 207
Damn, that looks familiar.....  I thought I took care of that error message...  (Big sigh)  Let me look into it again....

If you are looking for functionality to deal with existing attachments, then I can add that into the mod as well. 
YES, PLEASE!!!!!!!
I've attempted to add functionality to deal with existing attachments in version 1.1.  It seems that SMF's re-encoding process strips out the EXIF information from the images, so it CAN'T automatically rotate and/or flip the image(s) accordingly.....  So I'm at a loss on how to proceed with those instances....

I guess I could add something in the Profile -> Show Posts -> Attachments screen....  I just don't know what at this moment....

Just an arrow to turn and save
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on March 22, 2016, 06:47:07 PM
I guess I could add something in the Profile -> Show Posts -> Attachments screen....  I just don't know what at this moment....
Just an arrow to turn and save
Where?  On the attachment screen or on the post screen?
Title: Re: Automatic Attachment Rotation
Post by: dan4ever on March 24, 2016, 05:29:48 AM
I guess I could add something in the Profile -> Show Posts -> Attachments screen....  I just don't know what at this moment....
Just an arrow to turn and save
Where?  On the attachment screen or on the post screen?


The best I think is on the post screen.
For the Admin, moderator and the member how post it. Not for everybody!!!


/Dan
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on March 24, 2016, 08:50:02 PM
I guess I could add something in the Profile -> Show Posts -> Attachments screen....  I just don't know what at this moment....
Just an arrow to turn and save
Where?  On the attachment screen or on the post screen?
The best I think is on the post screen.
For the Admin, moderator and the member how post it. Not for everybody!!!
Do we have enough quotes here?  :P  I'll put it on the attachment list line, since it'd be easier for me to code around a known number of attachments than a variable number (due to adding additional attachments, etc).  Yeah, I know it'd mean that you have to upload, then see if the attachment is rotated correctly, but.....  I guess it'd be better than nothing (which is what SMF has right now)....

For the Admin, moderator and the member how post it. Not for everybody!!!
Duh....  :P
Title: Re: Automatic Attachment Rotation
Post by: dan4ever on March 24, 2016, 08:56:18 PM
OK
Title: Re: Automatic Attachment Rotation
Post by: dan4ever on March 25, 2016, 06:21:54 AM
Another idé...


Why not make this: in Admin -> Forum -> Attachments /(and)/ Thumbnails
Make an small preview of the picture on every line and ability to change/turn it.


/Dan 
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on March 25, 2016, 08:18:54 AM
Was thinking about doing something similar at the Profile -> Show Posts -> Attachments screen.....
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on March 25, 2016, 05:56:23 PM
Uploaded v1.2 - March 25th, 2016
o Fixed function calls in Subs-Graphics.php so that correct parameters are used.
o Added replacement "imagerotate" function for PHP < 4.3.  Unlikely to be needed, but whatever...



 :o Whoops.... O:) I finally figured out why my tests with images having a non-zero orientation were spastic....  The parameters of the function being called were half wrong...  Fixed that and the pictures are rotated correctly....  Verison 1.2 contains the updated XML ops and PHP files....

No, still not working.
And I got alot of this error:

Quote
http://www.guldforum.se/forum/index.php?topic=3302.msg29328 (http://www.guldforum.se/forum/index.php?topic=3302.msg29328)
The database value you're trying to insert does not exist: width
Function: AutoRotation_Update
Fil: /storage/content/******/guldforum.se/public_html/forum/Sources/Subs-AutoRotation.php
Rad: 207
Can you tell me if the error message still occurs?  I haven't gotten this error message on my localhost forum.....
Title: Re: Automatic Attachment Rotation
Post by: dan4ever on May 23, 2016, 07:10:10 AM
Hi, again


Have your latest update installed but the pic are still 45% wrong.


/Dan
Title: Re: Automatic Attachment Rotation
Post by: dan4ever on June 06, 2016, 07:12:13 PM

Can you tell me if the error message still occurs?  I haven't gotten this error message on my localhost forum.....

No more :)

Thanks!!!!

Another idé...


Why not make this: in Admin -> Forum -> Attachments /(and)/ Thumbnails
Make an small preview of the picture on every line and ability to change/turn it.


/Dan 
This would be nice, and maybe to work throu al the tumbnails/attachment and change them.

/Dan
Title: Re: Automatic Attachment Rotation
Post by: Rock Lee on June 07, 2016, 12:00:17 PM
Very good @dougiefresh I see now modified afternoon I looked closer :)


Regards!
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on June 30, 2016, 05:37:47 PM
Hello...tried installing your mod, but get this Database Error at the bottom of any topic I enter:

Unknown column 'thumb.proper_rotation' in 'field list'
File: /home2/yandc/public_html/test.#####.net/Sources/Display.php

I'm running 2.0.11

I do have the resize attachments mod.
Title: Re: Automatic Attachment Rotation
Post by: dan4ever on July 06, 2016, 12:59:48 PM
Hi, again


Have your latest update installed but the pic are still 45% wrong.


/Dan


The problem is still here...


/Dan
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on July 12, 2016, 07:07:09 PM
I'm trying to write the modification to the admin area where you can change the rotation of individual attachments manually....  Haven't forgotten about ya, just REALLY busy with work and a few other things.  :(
Title: Re: Automatic Attachment Rotation
Post by: dan4ever on July 13, 2016, 05:58:08 AM
Thanx!!!!!
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on August 20, 2016, 06:16:47 PM
About a month ago, I've lost my job and have been severely depressed.  I need some help, so if you want to help, please do so!

I've uploaded this mod to GitHub here: https://github.com/douglasorend/Automatic_Attachment_Rotation
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on September 15, 2016, 08:01:31 PM
Okay, I've started writing the stuff to manually rotate the images.  Attached is the current "mock-up" of the attachment screen...  Keep in mind that it is not set in stone yet, but the implementation doing it this way seems pretty straight forward.  Tell me what y'all think about this!  Thanks!
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on September 17, 2016, 09:34:32 PM
Uploaded v2.0 - September 17th, 2016
o Rewrote image processing function to work with built-in imagerotate and imageflip.
o Added several missing database query close statements.
o Added Admin changes to manually change the orientation of attachments.
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on September 20, 2016, 12:54:18 PM
Can someone assist with the issue I posted about earlier?  I really really want to try out this mod since many of my users post pic attachments and they always come out the wrong way.

Thanks!
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on September 20, 2016, 04:16:12 PM
Uploaded v2.1 - September 20th, 2016
o Fixed unknown column error in Display.php that occurs when thumbnails are disabled.



@kungfujoe:  Whoops!!  I didn't realize I missed a bug report!  I'm pretty sure it's been fixed for this version!!  Thank you for bringing it up again!
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on September 20, 2016, 06:18:45 PM
Uploaded v2.1 - September 20th, 2016
o Fixed unknown column error in Display.php that occurs when thumbnails are disabled.



@kungfujoe:  Whoops!!  I didn't realize I missed a bug report!  I'm pretty sure it's been fixed for this version!!  Thank you for bringing it up again!

Thanks for looking into this.  I uninstall 2.0 and installed 2.1 but now I get the following:

Parse error: syntax error, unexpected '(' in /home2/yandc/public_html/test.xxxxx.net/Sources/Subs-AutoRotation.php on line 193
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on September 20, 2016, 06:30:18 PM
I'm I'm definitely not a programmer but I think it was just an extra set of parenthesis around this part of code:

($row['thumb_rotation'])

Do you see the same on your end?  When I remove them, it seems to work.  But just want to make sure I'm not screwing something up.
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on September 20, 2016, 06:44:44 PM
Uploaded v2.2 - September 20th, 2016
o Fixed syntax error found in Subs-AutoRotation.php.  Thanks, kungfujoe (http://www.simplemachines.org/community/index.php?action=profile;u=387324)!


I'm I'm definitely not a programmer but I think it was just an extra set of parenthesis around this part of code:

($row['thumb_rotation'])

Do you see the same on your end?  When I remove them, it seems to work.  But just want to make sure I'm not screwing something up.
@kungfujoe:  Yeah, I looked at the code real closely and saw that.  I can't believe I missed that....   Thanks for reporting the bug!
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on September 20, 2016, 06:51:54 PM
Ok...I'm able to install the mod successfully.

However, it doesn't appear to be rotating images at all.  Could it be that I'm missing the phpExifRW class in PHP?

I see the option to rotate images in the Admin section, but I don't have any thumbnails for my images so it's difficult to know which way to rotate the images that are uploaded.
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on September 20, 2016, 06:55:06 PM
Ok...I can simply click on the image name and it will bring up a pop up window with the image so I can work off that.

However, when I try to rotate an image, I get the following:

Fatal error: Call to undefined function AutoRotation_Rotate() in /home2/yandc/public_html/test.xxxxx.net/Sources/ManageAttachments.php on line 157
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on September 20, 2016, 07:24:03 PM
Revised v2.2 - September 20th, 2016
o Fixed syntax error found in Subs-AutoRotation.php.  Thanks, kungfujoe (http://www.simplemachines.org/community/index.php?action=profile;u=387324)!
o Fixed issue in the attachment screen, where attachment IDs were not being sent correctly.
o Fixed undefined index error in Subs-AutoRotation.php.
o Added forgotten package instruction to run add_remove_hooks.php during package operations.



@Everybody:  Since nobody downloaded the original v2.2, I've fixed a few issues within it....

However, it doesn't appear to be rotating images at all.  Could it be that I'm missing the phpExifRW class in PHP?
No, that class is contained in Class-exifReader.php and is loaded by Subs-AutoRotation.php only if the needed EXIF function aren't available.  Once you rotate an image in the admin panel, you will have to force a refresh (CTRL-F5) on the image in order to see the result.
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on September 21, 2016, 12:54:47 AM
Thanks for continuing to work on this.

One typo I found is that when you choose to rotate an image in the Admin section, it prompts you if you want to REMOVE the image.  It rotates it fine...but the text is a bit misleading.  I'm sure it's an easy fix...but just FYI.
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on September 21, 2016, 12:56:23 AM
Ok...so now the rotate function is working.

Couple questions.

Any photo I take with my iPhone in Portrait mode is turned to the left sideways.  Is this supposed to be happening or should the exif data be telling the mod how to position the picture upright?  The pic is position correctly when I look at it in any viewer in Windows/MacOS

Are users able to rotate their own images or can it only be done from within the admin console?
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on September 21, 2016, 11:42:46 PM
Ok...so now the rotate function is working.
Good to hear!

Any photo I take with my iPhone in Portrait mode is turned to the left sideways.  Is this supposed to be happening or should the exif data be telling the mod how to position the picture upright?  The pic is position correctly when I look at it in any viewer in Windows/MacOS
Yes, the EXIF information tells the mod how to rotate and/or flip the image so that it is viewed correctly.  There are several reasons why this might happen.  First, the EXIF information itself is incorrect (can't fix).  Second, the mod is reading the EXIF information incorrectly (can fix).  Third, the mod is rotating the image incorrectly (can fix).  Fourth, there is no EXIF information in the image (can't fix).

Can you attach the ORIGINAL image in question to a post or send by PM?  I need to examine and experiment with the image....

Are users able to rotate their own images or can it only be done from within the admin console?
Currently, it can only be done within the admin console.  I'll add some more stuff so that regular users can rotate their own images.....
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on September 22, 2016, 02:53:00 PM
If I attach the image here won't this forum just strip out the EXIF information?

Perhaps I could email you?
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on September 22, 2016, 04:53:32 PM
If I attach the image here won't this forum just strip out the EXIF information?

Perhaps I could email you?
You are right, it might strip out the EXIF information.  I'll PM you with my email address.

EDIT: I did some testing using images from GitHub (https://github.com/recurser/exif-orientation-examples) on two different platforms: PHP 5.7 (which has the imagerotate and imageflip functions built-in), as well as PHP 5.3.9 (which do not). Both rotate and flip the images correctly, so I don't think it's the mod....

Hmmmm....  I didn't think about the forum itself stripping out the EXIF information....  I'll further look into this.
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on September 22, 2016, 06:57:13 PM
@kungfujoe: I got your picture.  The EXIF information is there and appears correct.  However, my localhost SMF install won't allow me to attach it to a post....  Hmmmm.

EDIT:  The Simple Machines Forum does, though....  I uninstalled the mod from my localhost, then tried again to attach it.  Still failed, so clearly this particular issue isn't a mod issue.  However, I can't test it if I can't upload it to my localhost server....   :o
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on September 25, 2016, 10:37:23 PM
UPDATE:  Sorry about the delay in responding.  It took some work, along with a considerable amount of fiddling with the settings of my Apache/PHP/MySQL server that I was using in order to get my localhost forum to upload the image.  Once I did, the forum correctly rotated and/or flipped the image so that it was upright....
Title: Re: Automatic Attachment Rotation
Post by: dan4ever on September 26, 2016, 08:51:55 AM
Good work!!!!


But I have "Highslide Image Viewer[/size][size=78%]" installed and the big picture that will come up when I click the pic is not turned.[/size]
[/size]Probably incompatibly  whith yours mod.[size=78%]
[/size][size=78%]But I really [/size][size=78%][/size]want the both och if you can include that too !!!!  ????[size=78%]


[/size][size=78%]/Dan  [/size][size=78%]
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on September 26, 2016, 09:39:12 AM
Uploaded v2.3 - September 26th, 2016
o Added code to include timestamps on attachment URLs to circumvent browser caching.


But I have "Highslide Image Viewer" installed and the big picture that will come up when I click the pic is not turned.
Probably incompatibly  whith yours mod.
But I really want the both och if you can include that too !!!!  ????

Dan
I fixed the mod a few days so that the attachment URLs are modified with the timestamp, just to circumvent the browser caching crap that is built into SMF....  Once an image is turned, it should show up using Highslide Image Viewer as turned.

 :o Btw, what's with all the extra tags?  Makes your post incredibly difficult to read....  Anyway, I removed the extra tags, just so it's readable in quotes....  O:)
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on September 26, 2016, 04:05:47 PM
UPDATE:  Sorry about the delay in responding.  It took some work, along with a considerable amount of fiddling with the settings of my Apache/PHP/MySQL server that I was using in order to get my localhost forum to upload the image.  Once I did, the forum correctly rotated and/or flipped the image so that it was upright....

Hmmm...the pic doesn't rotate automatically on my site.  Do you think it could be an issue with missing a PHP class?
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on September 26, 2016, 04:16:33 PM
Hmmm...the pic doesn't rotate automatically on my site.  Do you think it could be an issue with missing a PHP class?
I doubt it.  If there was a missing PHP class, the topic display wouldn't function.  Let me investigate this bug report.....
Title: Re: Automatic Attachment Rotation
Post by: blunted on September 28, 2016, 10:07:06 PM
$txt['img_orientation'] = 'Rotate Clockwise'; $txt['img_orientation1'] = 'None'; $txt['img_orientation2'] = 'Horizontal Flip'; $txt['img_orientation3'] = 'Rotate 180°'; $txt['img_orientation4'] = 'Vertical Flip'; $txt['img_orientation5'] = 'Vertical Flip, Rotate 270°'; $txt['img_orientation6'] = 'Rotate 270°'; $txt['img_orientation7'] = 'Horizontal Flip, Rotate 270°'; $txt['img_orientation8'] = 'Rotate 90°';

getting this in admin
Title: Re: Automatic Attachment Rotation
Post by: dan4ever on September 30, 2016, 05:46:00 AM

 :o Btw, what's with all the extra tags?  Makes your post incredibly difficult to read....  Anyway, I removed the extra tags, just so it's readable in quotes....  O:)


It comes when I copy/paste...
I don't like it at al...


/Dan
Title: Re: Automatic Attachment Rotation
Post by: dan4ever on September 30, 2016, 06:20:08 AM
$txt['img_orientation'] = 'Rotate Clockwise'; $txt['img_orientation1'] = 'None'; $txt['img_orientation2'] = 'Horizontal Flip'; $txt['img_orientation3'] = 'Rotate 180°'; $txt['img_orientation4'] = 'Vertical Flip'; $txt['img_orientation5'] = 'Vertical Flip, Rotate 270°'; $txt['img_orientation6'] = 'Rotate 270°'; $txt['img_orientation7'] = 'Horizontal Flip, Rotate 270°'; $txt['img_orientation8'] = 'Rotate 90°';

getting this in admin


Open the file in Theme/default/languages with the name "Admin.english.php"  and at the end there should be a "?>"  and no one before.
Just move this   ?>   one to the end.


/Dan
Title: Re: Automatic Attachment Rotation
Post by: blunted on September 30, 2016, 07:29:14 AM
$txt['img_orientation'] = 'Rotate Clockwise'; $txt['img_orientation1'] = 'None'; $txt['img_orientation2'] = 'Horizontal Flip'; $txt['img_orientation3'] = 'Rotate 180°'; $txt['img_orientation4'] = 'Vertical Flip'; $txt['img_orientation5'] = 'Vertical Flip, Rotate 270°'; $txt['img_orientation6'] = 'Rotate 270°'; $txt['img_orientation7'] = 'Horizontal Flip, Rotate 270°'; $txt['img_orientation8'] = 'Rotate 90°';

getting this in admin

ty :)
Open the file in Theme/default/languages with the name "Admin.english.php"  and at the end there should be a "?>"  and no one before.
Just move this   ?>   one to the end.


/Dan
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on October 12, 2016, 10:18:01 AM
Uploaded v2.4 - October 12th, 2016
o Removed code that may flag images as processed when they haven't been.
o Added an additional check to make sure we only rotate IMAGES!
o Added code in the admin attachment area to clear image orientation flags.
o Added code to prevent double-processing of images and thumbnails.
o Fixed excluded database fields in Display.php database query.
o SMF 2.0: Modified admin attachment code to hook the previous function used.



@Everybody:  Hopefully, this update solves the problem of images not being rotated, but only if they have the EXIF information still in them....  This update will NOT fix images that have been re-encoded for any reason, as the EXIF information has been stripped out of the image.  This update WILL NOT fix any image that never had EXIF information in it.
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on October 13, 2016, 08:31:24 PM
UPDATE: I've been tinkering with the mod in the last few days, getting an option to allow the user to manually rotate their pictures while editing the post.  I've discovered that the attachment information given to the mod's code isn't reliable, and I've have to retool the mod in order to make it work for all pictures, both new and current pics.  I should have a new version out in the next few days, time allowing....

EDIT: Also, the thumbnail doesn't appear to update after the image is manually rotated, unless the browser is forced to reload everything.  This will be fixed with the next version, as well....
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on October 15, 2016, 08:14:44 PM
Uploaded v3.0 - October 15th, 2016
o Added code to the post editing template to manually rotate images.
o Added code to include timestamps on thumbnail URLs to circumvent browser caching.
o Fixed rotation code to get image format instead of relying on database information.
o Reduced potential database requests by merging attachment fetching database requests.
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on October 31, 2016, 07:49:57 AM
Uploaded v3.1 - October 31st, 2016
o Fixed missing array element errors when trying to get thumbnail attachment timestamp.
o Fixed issue where errors where generated because no filename was given to filemtime.
o Fixed LoadLanguage operation so that it does not rely on the global declaration.
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on January 13, 2017, 01:17:42 PM
I'm not sure if this is browser specific but when I edit a post to rotate an image...when I choose a rotation from the drop down, it will automatically uncheck the attachment.  If someone isn't aware of this and saves the modified post, it will delete the attachment.

Any one else experiencing this?  I'm using Safari on a Mac (Sierra)
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on January 13, 2017, 02:02:53 PM
Also, the rotation appears to happen counter clockwise, not clockwise.
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on January 13, 2017, 09:53:21 PM
I'm not sure if this is browser specific but when I edit a post to rotate an image...when I choose a rotation from the drop down, it will automatically uncheck the attachment.  If someone isn't aware of this and saves the modified post, it will delete the attachment.

Any one else experiencing this?  I'm using Safari on a Mac (Sierra)
Sorry, I can't reproduce this bug.  I've tested it on a PC with FireFox, Internet Explorer (gasp!) and Chrome.  None of the 3 browsers that I tested have unchecked the attachment box to the left of the attachment name.  I also looked in both the install_20x.xml as well as the Post.template.php, and there is nothing that would clear the attachment checkbox in a clean 2.0.13 forum with this mod installed.

There may be some conflict between this mod and another mod you might be running.  Without a mod list, SMF version number, and mod version number, I wouldn't be able to even guess as to why you're experiencing this issue......

Also, the rotation appears to happen counter clockwise, not clockwise.
I'm going to assume that you mean the image is rotated without you specifying the rotation value, since you haven't given me much to work on.  I can't reproduce this either.  If you change the rotation selection box and then click Post, of course it's going to rotate/flip the image in the direction specified.   That's by design.
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on January 18, 2017, 02:14:40 PM
I think I'm still on SMF 2.0.12.  Haven't updated to 13 just yet.  I also quite a lot of mods so I will do some testing on my test site to see if one of them is affecting that checkbox.  Just to be clear, it only unchecks the attachment when I modify the rotation using the drop down.  The easy workaround is to simply recheck it.

As for the rotation, it rotates...but the opposite direction.

If you choose 90 degrees...it will rotate 90 degrees counter clockwise. 
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on January 21, 2017, 09:18:53 AM
Post your Themes/default/Post.template.php, so I might be able to see what is happening....
Title: Re: Automatic Attachment Rotation
Post by: landyvlad on January 26, 2017, 06:39:42 AM
OK so I installed it but

1) Is it supposed to auto-rotate existing attachments? Because it didn't in two cases (images do have basic EXIF data) .  I checked first - no then I clicked on the clear rotation flags.  Still no change.

2) Can the user ONLY rotate the attachment at time of upload, and not once attached?  Users often aren't sure of orientation and don't notice until its been attached. Can they then rotate it somehow?

 
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on January 26, 2017, 11:13:44 AM
1) Is it supposed to auto-rotate existing attachments? Because it didn't in two cases (images do have basic EXIF data) .  I checked first - no then I clicked on the clear rotation flags.  Still no change.
If the mod CAN auto-rotate the image, it is supposed to.

2) Can the user ONLY rotate the attachment at time of upload, and not once attached?  Users often aren't sure of orientation and don't notice until its been attached. Can they then rotate it somehow?
The user can edit the post, go down to the attachments, and instruct the forum to rotate it either 90, 180, or 270 degrees clockwise, and/or flip it horizontally or vertically.  Once that is complete, submit the post and it should be rotated when viewing it next time.
Title: Re: Automatic Attachment Rotation
Post by: landyvlad on January 26, 2017, 09:26:19 PM
OK cool thanks.

I checked one of the images with Photoshop to read the EXIF data - its has information on the camera etc but in none of the numerous potential categories of EXIF data did I see any image orientation flag....  Do you happen to know how this is recorded in EXIF data? (as in, what category, by what name/description)

Cheers
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on January 27, 2017, 10:11:25 PM
I checked one of the images with Photoshop to read the EXIF data - its has information on the camera etc but in none of the numerous potential categories of EXIF data did I see any image orientation flag.... 
Well, that would be why the mod can't rotate the picture.....

Do you happen to know how this is recorded in EXIF data? (as in, what category, by what name/description)
Sorry, I don't know how it is recorded in the EXIF data.  The EXIF reading library (http://www.phpclasses.org/package/1042-PHP-EXIF-information-reader-and-writer.html) that I included handles all of that processing if the built-in function exif_read_data doesn't exist. 
Title: Re: Automatic Attachment Rotation
Post by: landyvlad on January 29, 2017, 08:40:27 PM
Yeah I'm just a bit confused by the exif data as there is no field (blank or otherwise) which apparently pertains to rotation / orientation. Perhaps it's called something not obvious...

As I say the camera has recorded basic EXIF camera type etc and I am ASSUMING that orientation would be considered as "basic" data so would ASSUME that this would have been recorded as well.

I'll have to take a photo so I KNOW it has exif data and test it.  Cheers.
Title: Re: Automatic Attachment Rotation
Post by: PBSCreative on February 02, 2017, 11:01:52 AM
I've installed the extension, but it's still got the wrong orientation for images uploaded direct from iPhone.

Looking at Preview inspector on MacOS it puts the Orientation tag under "TIFF", not EXIF.

Could that be why it's being ignored?
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on February 05, 2017, 09:49:36 AM
@PBSCreative: Can you attach the image so that I can try to figure out how to detect the orientation correctly for that image?
Title: Re: Automatic Attachment Rotation
Post by: PBSCreative on February 06, 2017, 06:47:44 AM
@PBSCreative: Can you attach the image so that I can try to figure out how to detect the orientation correctly for that image?
Hi, thanks for responding. Here's an example, let's see if I can attach here or if I need to host it elsewhere for you to get an untangled version....

EXIF version difference maybe?
http://www.exiv2.org/tags-xmp-tiff.html
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on February 06, 2017, 09:53:22 AM
Uploaded v3.2 - February 6th, 2016
o Fixed function returning orientation when EXIF function is available.
o Fixed error generated by PBSCreative's image during alternative EXIF function testing.



@PBSCreative:  Thank you for attaching the picture.  Hopefully the problem has been fixed!
Title: Re: Automatic Attachment Rotation
Post by: PBSCreative on February 06, 2017, 10:28:03 AM
Uploaded v3.2 - February 6th, 2016
o Fixed function returning orientation when EXIF function is available.
o Fixed error generated by PBSCreative's image during alternative EXIF function testing.



@PBSCreative:  Thank you for attaching the picture.  Hopefully the problem has been fixed!

That's great, thanks. Unfortunately I can't test in our environment with this image as it keeps white screening, I'm assuming PHP is running into a problem or out of memory. If I remove this extension it's OK.
I'll have to look later, as I can't find where this host server has buried its php error reporting logs.
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on February 06, 2017, 11:54:53 AM
I also get the white screen using 3.2 when trying to rotate an image after posting.

It appears to be somewhat random.  The good news is that...the one time it worked, it did correctly set the orientation for a photo I took with my iPhone.  The same image shows sideways when using 3.1 of the mod.
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on February 07, 2017, 11:44:27 AM
I also get the white screen using 3.2 when trying to rotate an image after posting.

It appears to be somewhat random.  The good news is that...the one time it worked, it did correctly set the orientation for a photo I took with my iPhone.  The same image shows sideways when using 3.1 of the mod.
I'm going to take a guess and say that is a out-of-memory issue.  I'll see if I can figure something out, so that at least you won't white-screen, which means: If it has the memory to do the rotation/flip thing, it'll do so.....
Title: Re: Automatic Attachment Rotation
Post by: landyvlad on February 08, 2017, 04:16:54 AM
best way to upgrade from 3.1 - uninstall 3.1 and install new one?
Title: Re: Automatic Attachment Rotation
Post by: PBSCreative on February 08, 2017, 06:47:22 AM
best way to upgrade from 3.1 - uninstall 3.1 and install new one?
That's what I did without a hitch.
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on February 10, 2017, 01:04:38 PM
Uploaded v3.3 - February 10th, 2017
o Added code to attempt to get 128M of memory for our operations.
o Changed forum code to attempt to get 128M instead of 90M.



@kungfujoe:  Hopefully, this update fixes the out-of-memory issue you are seeing.....

best way to upgrade from 3.1 - uninstall 3.1 and install new one?
That's the only way to upgrade.....
Title: Re: Automatic Attachment Rotation
Post by: PBSCreative on February 13, 2017, 05:34:58 AM
Uploaded v3.3 - February 10th, 2017
o Added code to attempt to get 128M of memory for our operations.
o Changed forum code to attempt to get 128M instead of 90M.

We did this in the code late Friday and it sorted it. In the logs it was just tipping over the 90M of allocated memory.
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on February 13, 2017, 01:01:43 PM
I'm still getting the white screen issue with 3.3.
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on February 13, 2017, 01:02:09 PM
Uploaded v3.3 - February 10th, 2017
o Added code to attempt to get 128M of memory for our operations.
o Changed forum code to attempt to get 128M instead of 90M.

We did this in the code late Friday and it sorted it. In the logs it was just tipping over the 90M of allocated memory.

Where in the logs can you see how much memory is being used?
Title: Re: Automatic Attachment Rotation
Post by: PBSCreative on February 15, 2017, 05:17:32 AM
Uploaded v3.3 - February 10th, 2017
o Added code to attempt to get 128M of memory for our operations.
o Changed forum code to attempt to get 128M instead of 90M.

We did this in the code late Friday and it sorted it. In the logs it was just tipping over the 90M of allocated memory.
When it was set to 90 it showed it was trying to allocate x bytes more than available.
Where in the logs can you see how much memory is being used?
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on February 15, 2017, 09:29:18 AM
@kungfujoe:  I'm guessing PBSCreative meant server logs, not SMF logs.  The location of such logs would be specific to the server you are running on.....
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on February 16, 2017, 01:25:32 PM
I don't know if this is specific to the server I'm running on, but the issue I'm having with the white screen is with larger file sizes.  If I attach a <2MB pic...it's fine.  Tried a 2.8MB pic and white screen.

3.2 is better than 3.3 in this regard...in that I can attach larger sizes...but even with 3.2, when I tried to attach an 8MB pic, I got the white screen.
Title: Re: Automatic Attachment Rotation
Post by: PBSCreative on February 16, 2017, 01:59:42 PM
I don't know if this is specific to the server I'm running on, but the issue I'm having with the white screen is with larger file sizes.  If I attach a <2MB pic...it's fine.  Tried a 2.8MB pic and white screen.

3.2 is better than 3.3 in this regard...in that I can attach larger sizes...but even with 3.2, when I tried to attach an 8MB pic, I got the white screen.
The bigger the image, the more resources required to process it. So small images will be OK with less memory.
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on February 16, 2017, 04:50:29 PM
I don't know if this is specific to the server I'm running on, but the issue I'm having with the white screen is with larger file sizes.  If I attach a <2MB pic...it's fine.  Tried a 2.8MB pic and white screen.

3.2 is better than 3.3 in this regard...in that I can attach larger sizes...but even with 3.2, when I tried to attach an 8MB pic, I got the white screen.
The bigger the image, the more resources required to process it. So small images will be OK with less memory.

Is that a limit with my server or with SMF?  Would like to be able to use this mod with larger file sizes...at least up to 10MB.

I also have a mod that reduces the file size and resolution of attached images.  This was so members didn't have to worry about reducing pics on their own (some are not technically savvy) and so I didn't have to worry about filling up my server storage anytime soon.  But it appears that this mod starts processing before the file size mod kicks in.
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on February 16, 2017, 05:01:51 PM
Hmm...on a hunch, I uninstalled my mod that resizes attached images...reinstalled this mod (3.3) and then reinstalled my resize image mod...and now everything seems to work.  Was able to upload that 8MB pic I was referring to earlier.

So hope this does it.  :)
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on February 16, 2017, 06:11:01 PM
Hmm...on a hunch, I uninstalled my mod that resizes attached images...reinstalled this mod (3.3) and then reinstalled my resize image mod...and now everything seems to work.  Was able to upload that 8MB pic I was referring to earlier.

So hope this does it.  :)
Can you link to the mod you are talking about?  Maybe I can come up with some workaround for this situation.....
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on February 17, 2017, 01:54:43 PM
Hmm...on a hunch, I uninstalled my mod that resizes attached images...reinstalled this mod (3.3) and then reinstalled my resize image mod...and now everything seems to work.  Was able to upload that 8MB pic I was referring to earlier.

So hope this does it.  :)
Can you link to the mod you are talking about?  Maybe I can come up with some workaround for this situation.....

http://custom.simplemachines.org/mods/index.php?mod=2206
Title: Re: Automatic Attachment Rotation
Post by: KungFuJoe on February 27, 2017, 11:43:55 AM
Had to remove v3.3 of this mod and revert back to 3.1.  3.2 and 3.3 both have the white screen issue on my server if I try to attach pic(s) that exceed around 8MB in total file size.

I think the reason why 3.1 "works" is because the auto image rotation actually doesn't work on my site...so pics still end up with the wrong orientation but at least I can go in and manually fix them with the mod.
Title: Re: Automatic Attachment Rotation
Post by: tanawat on March 09, 2017, 12:33:19 PM


after browse picture
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fupic.me%2Fi%2Fm3%2Funtitledsss.png&hash=43bb26f24f284216d0509b1e72bcd488) (http://upic.me/show/60450233)

when modify post
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fupic.me%2Fi%2F5k%2F0untitled44.png&hash=376ab02da06296cbfe027d5fd4e0dfc5) (http://upic.me/show/60450234)

Appear when modify post isn't  it ?
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on March 09, 2017, 09:08:27 PM
@tanawat:  I'm sorry.  I don't understand your question....  (if there is indeed one...)
Title: Re: Automatic Attachment Rotation
Post by: Westwegoman on March 19, 2017, 03:23:58 PM

As for the rotation, it rotates...but the opposite direction.

If you choose 90 degrees...it will rotate 90 degrees counter clockwise.

I'm having the same issue. SMF 2.0.13

Post.template.php attached

Also,

When browsing through files... Admin > Attachments and Avatars > Browse Files, is there a way to get the images to show up on that page that I'm missing?
Title: Re: Automatic Attachment Rotation
Post by: rajanmahajan on May 02, 2017, 09:11:46 AM
Hi.... It's not working properly....
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on August 04, 2017, 11:21:09 PM
UPDATE:  I apologize to everybody for taking so long to look into this mod's bug reports.  Hopefully, there will be an update shortly....  but I am working on it.
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on August 05, 2017, 11:25:26 AM
Uploaded v3.4 - August 5th, 2017
o Added code to dynamically adjust memory to try to stop white screen issues.



@KungFuJoe:  Hopefully, this update solves the white screen issues.  One caveat: If the mod can't allocate enough memory, it just won't do anything with the image.  I'll add something in the settings to log the issue when it happens for the next version....

@rajanmahajan:  Much wow.  So much description.  :-[

@Westwegoman:  Still looking into your bug report.  Please be patient...
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on August 16, 2017, 05:35:28 PM
Anyone care to comment on the last version?
Title: Re: Automatic Attachment Rotation
Post by: aegersz on August 19, 2017, 04:19:41 AM
I LOVE this mod because suddenly all my pics were rotated 90 degrees anti-clockwise.

you are a ******ing LEGEND dougie. At least half of my website mods were written by you.

EXCELLENT JOB !

the only glitch was that i i had to add a blank line before your check for the Hacker poll thing and then it installed like a dream.
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on September 04, 2017, 11:22:36 PM
Uploaded v3.5 - September 4th, 2017
o Added support for SMF 2.1 Beta 3.
o Removed support for SMF 2.1 Beta 2.
o Added ability to log "unable to allocate enough memory" errors.
o Added setting to enable logging of "unable to allocate enough memory" errors.
o Replaced code for fallback mod-defined imagerotate function.
o FALLBACK: Try to get 256MB of memory if memory_get_usage function not available.



@aegersz:  Blank line issue has been fixed as well...  Thanks for the bug report!
Title: Re: Automatic Attachment Rotation
Post by: Baitjunky on September 08, 2017, 03:30:24 PM
Im getting this error after install on 2.0.14

Parse error: syntax error, unexpected end of file in /home/baitjunkys/public_html/forum/Sources/Subs-AutoRotation.php on line 464
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on September 08, 2017, 08:30:17 PM
Uploaded v3.6 - September 8th, 2017
o Fixed 2 syntax errors in Subs-AutoRotation.php.



@Baitjunky:  Man, oh man, typo city here.... Thank you for reporting the syntax error.  It's been fixed with this version!
Title: Re: Automatic Attachment Rotation
Post by: aegersz on September 10, 2017, 12:28:57 AM
sorry dougie but another minor conflict in what appears to be a duplication (the two install failing lines do the same thing ?) in  Sources/Display.php ; all your other mods are at the lastest version, installed and working but i am assuming they are conflicting with this one now ... see the attached screenshots:
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on September 10, 2017, 04:13:06 PM
I'll take a look at it when I get home from work.
Title: Re: Automatic Attachment Rotation
Post by: aegersz on September 12, 2017, 08:57:11 AM
no hurry. at all. maybe it's my fault ? that's highly likely but then again i think i run almost all of your mods.
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on September 12, 2017, 10:01:06 AM
It's definitely a conflict between Post and PM Inline Attachments and this mod.....  Still looking at how to resolve this...
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on September 12, 2017, 10:23:40 AM
Uploaded v3.7 - September 12th, 2017
o Resolved conflict with Post and PM Inline Attachments (http://custom.simplemachines.org/mods/index.php?mod=3770).  No functionality change.



@aegersz:  This update should take care of the conflict that you reported.
Title: Re: Automatic Attachment Rotation
Post by: aegersz on September 12, 2017, 10:30:09 AM
so it does ! thanks again, dougie !
Title: Re: Automatic Attachment Rotation
Post by: aegersz on September 12, 2017, 12:32:30 PM
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
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on September 12, 2017, 11:47:09 PM
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


(https://avatanplus.com/files/resources/mid/56aced0bcec19152937df647.png)
@aegersz:  I swear I'll get this right....  Might not be today, but I'll get it right....  O:)
Title: Re: Automatic Attachment Rotation
Post by: aegersz on September 13, 2017, 01:26:29 AM
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 !
Title: Re: Automatic Attachment Rotation
Post by: aegersz on October 04, 2017, 09:36:55 AM
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:
Code: [Select]
'href' => $scripturl . '?action=dlattach . ';ts=' . $time . ';topic=' . $msg_topic . '.0;attach=' . $attachment['id_attach'],
with:
Code: [Select]
'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 ...
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on October 09, 2017, 09:03:50 AM
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.
Title: Re: Automatic Attachment Rotation
Post by: 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)

Thanks
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on December 18, 2017, 09:15:35 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.
Title: Re: Automatic Attachment Rotation
Post by: @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
Title: Re: Automatic Attachment Rotation
Post by: @rjen on December 30, 2017, 07:32:07 AM
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';
Title: Re: Automatic Attachment Rotation
Post by: @rjen on December 30, 2017, 08:00:06 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
Title: Re: Automatic Attachment Rotation
Post by: 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. :)
Title: Re: Automatic Attachment Rotation
Post by: landyvlad on January 20, 2018, 02:16:31 AM
dougiefresh  - should I

1. Uninstall, ignoring the errors, or
2 Just install the new one over the top, or
3 Something else ?
Title: Re: Automatic Attachment Rotation
Post by: GL700Wing on January 20, 2018, 04:31:27 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:
Code: [Select]
$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:
Code: [Select]
$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).
Code: [Select]
$memoryLimit = (float) ini_get('memory_limit');
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on January 21, 2018, 08:27:51 PM
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.....
Title: Re: Automatic Attachment Rotation
Post by: GL700Wing on January 22, 2018, 12:42:43 AM
@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.
Title: Re: Automatic Attachment Rotation
Post by: landyvlad on January 22, 2018, 02:12:30 AM
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.
Title: Re: Automatic Attachment Rotation
Post by: landyvlad on January 22, 2018, 06:00:32 PM
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.
Title: Re: Automatic Attachment Rotation
Post by: GL700Wing on January 22, 2018, 08:34:05 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).
Title: Re: Automatic Attachment Rotation
Post by: Rock Lee on February 12, 2018, 07:47:21 PM
I just realized the current but you can see at that moment it did not translate, that's why I leave it to Spanish now! 8)


Regards!
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on February 13, 2018, 10:02:05 PM
Uploaded v3.9 - February 13th, 2018
o Added Spanish Latin translation, courtsey of Rock Lee (https://www.simplemachines.org/community/index.php?action=profile;u=322597).
o Added translators section to README.txt.
o Added LICENSE.txt to satisfy licensing concerns.



@Rock Lee:  Thank you for the translation!!  It's been included in this version!
Title: Re: Automatic Attachment Rotation
Post by: GL700Wing on February 17, 2018, 06:26:49 AM
Uploaded v3.9 - February 13th, 2018
Would you please include the fix for A non well formed numeric value encountered (https://www.simplemachines.org/community/index.php?topic=544111.msg3958439#msg3958439) in the next release - as requested I have verified (https://www.simplemachines.org/community/index.php?topic=544111.msg3958933#msg3958933) that it works with SMF 2.0.15 and PHP 5.6.
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on February 17, 2018, 11:30:43 AM
Uploaded v3.10 - February 17th, 2018
o Included "Non well-formed number" fix by GL700Wing (https://www.simplemachines.org/community/index.php?action=profile;u=112942), as discussed here (https://www.simplemachines.org/community/index.php?topic=544111.msg3958439#msg3958439).



@GL700Wing:  Whoops!  I completely forgot about that fix when I released the last version!  It's been included for this version, though!  Thanks!
Title: Re: Automatic Attachment Rotation
Post by: GL700Wing on February 18, 2018, 10:53:42 PM
I installed this mod and discovered that, as per this post (https://www.simplemachines.org/community/index.php?topic=544111.msg3954833#msg3954833), images didn't rotate as expected - in fact 'Rotate 90o Clockwise' and 'Rotate 270o Clockwise' both had the opposite effect to what I expected.  In addition, I thought some of the 'action' descriptions (eg, 'Rotate 270o Clockwise' ) could be made clearer (eg, 'Rotate 90o Left').

So - I've made the following minor changes on my forum.

I changed the text strings in ./Themes/default/languages/AutoRotation.english.php as follows:
Code: [Select]
$txt['img_orientation'] = 'Rotate/Flip';
$txt['img_orientation1'] = 'No Change';
$txt['img_orientation2'] = 'Horizontal Flip';
$txt['img_orientation3'] = 'Rotate 180&deg;';
$txt['img_orientation4'] = 'Vertical Flip';
$txt['img_orientation5'] = 'Vertical Flip, Rotate 90&deg; Right';
$txt['img_orientation6'] = 'Rotate 90&deg; Right';
$txt['img_orientation7'] = 'Horizontal Flip, Rotate 90&deg; Right';
$txt['img_orientation8'] = 'Rotate 90&deg; Left';
$txt['img_rotate'] = 'Rotate/Flip Images';

And I've changed the drop-down menu selection order in ./Sources/ManageAttachments.php and ./Themes/default/Post.template.php to:
Code: [Select]
<option value="0">' . $txt['img_orientation1'] . '</option><option value="6">' . $txt['img_orientation6'] . '</option><option value="8">' . $txt['img_orientation8'] . '</option><option value="3">' . $txt['img_orientation3'] . '</option><option value="2">' . $txt['img_orientation2'] . '</option><option value="4">' . $txt['img_orientation4'] . '</option><option value="7">' . $txt['img_orientation7'] . '</option><option value="5">' . $txt['img_orientation5'] . '</option>
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on February 20, 2018, 07:36:30 PM
@Rock Lee:  Can you translate these strings properly for this new version?  Thanks!
Code: [Select]
$txt['img_orientation'] = 'Rotate/Flip';
$txt['img_orientation1'] = 'No Change';
$txt['img_orientation2'] = 'Horizontal Flip';
$txt['img_orientation3'] = 'Rotate 180&deg;';
$txt['img_orientation4'] = 'Vertical Flip';
$txt['img_orientation5'] = 'Vertical Flip, Rotate 90&deg; Right';
$txt['img_orientation6'] = 'Rotate 90&deg; Right';
$txt['img_orientation7'] = 'Horizontal Flip, Rotate 90&deg; Right';
$txt['img_orientation8'] = 'Rotate 90&deg; Left';
$txt['img_rotate'] = 'Rotate/Flip Images';

@GL700Wing:  I'm implementing the changes you suggested.  Once Rock Lee gives me the translations, I'll publish the new version!
Title: Re: Automatic Attachment Rotation
Post by: Rock Lee on February 20, 2018, 08:04:11 PM
No problem, here they are translated 8)

Code: [Select]
$txt['img_orientation'] = 'Girar / Voltear';
$txt['img_orientation1'] = 'Ning&uacute;n cambio';
$txt['img_orientation2'] = 'Flip horizontal';
$txt['img_orientation3'] = 'Girar 180&deg;';
$txt['img_orientation4'] = 'Vertical Flip';
$txt['img_orientation5'] = 'Vertical Flip, Girar 90&deg; Derecha';
$txt['img_orientation6'] = 'Girar 90&deg; Derecha';
$txt['img_orientation7'] = 'Flip horizontal, Girar 90&deg; Derecha';
$txt['img_orientation8'] = 'Girar 90&deg; Izquierda';
$txt['img_rotate'] = 'Girar / Voltear im&aacute;genes';

Whatever you need, call me...


Regards!
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on February 20, 2018, 10:15:39 PM
Uploaded v3.11 - February 20th, 2018
o Updated Spanish Latin translations, courtsey of Rock Lee (https://www.simplemachines.org/community/index.php?action=profile;u=322597).
o Changed rotation/flip strings for better understandability, per GL700Wing (https://www.simplemachines.org/community/index.php?action=profile;u=112942)'s post above.
o Changed order of rotation/flip strings in templates, per GL700Wing (https://www.simplemachines.org/community/index.php?action=profile;u=112942)'s post above.



@Rock Lee and @GL700Wing:  Thank you both for your contributions!  They are appreciated, since lately I can't seem to get my sh#t together well enough....  Plus I'm sick with a damn sinus infection from hell!   UGH!!!
Title: Re: Automatic Attachment Rotation
Post by: GL700Wing on February 20, 2018, 10:29:14 PM
You're welcome - hope you're feeling better soon.
Title: Re: Automatic Attachment Rotation
Post by: @rjen on February 21, 2018, 05:13:32 PM
I installed this mod and discovered that, as per this post (https://www.simplemachines.org/community/index.php?topic=544111.msg3954833#msg3954833), images didn't rotate as expected - in fact 'Rotate 90o Clockwise' and 'Rotate 270o Clockwise' both had the opposite effect to what I expected.  In addition, I thought some of the 'action' descriptions (eg, 'Rotate 270o Clockwise' ) could be made clearer (eg, 'Rotate 90o Left').

So - I've made the following minor changes on my forum.

I changed the text strings in ./Themes/default/languages/AutoRotation.english.php as follows:
Code: [Select]
$txt['img_orientation'] = 'Rotate/Flip';
$txt['img_orientation1'] = 'No Change';
$txt['img_orientation2'] = 'Horizontal Flip';
$txt['img_orientation3'] = 'Rotate 180&deg;';
$txt['img_orientation4'] = 'Vertical Flip';
$txt['img_orientation5'] = 'Vertical Flip, Rotate 90&deg; Right';
$txt['img_orientation6'] = 'Rotate 90&deg; Right';
$txt['img_orientation7'] = 'Horizontal Flip, Rotate 90&deg; Right';
$txt['img_orientation8'] = 'Rotate 90&deg; Left';
$txt['img_rotate'] = 'Rotate/Flip Images';

And I've changed the drop-down menu selection order in ./Sources/ManageAttachments.php and ./Themes/default/Post.template.php to:
Code: [Select]
<option value="0">' . $txt['img_orientation1'] . '</option><option value="6">' . $txt['img_orientation6'] . '</option><option value="8">' . $txt['img_orientation8'] . '</option><option value="3">' . $txt['img_orientation3'] . '</option><option value="2">' . $txt['img_orientation2'] . '</option><option value="4">' . $txt['img_orientation4'] . '</option><option value="7">' . $txt['img_orientation7'] . '</option><option value="5">' . $txt['img_orientation5'] . '</option>

Nice to see that you picked up my request. I made these changes as well, but got not reply on the question. Thought it was forgotten...
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on February 21, 2018, 07:52:48 PM
Sorry about that, @rjen!  I really didn't know how to fix it....
Title: Re: Automatic Attachment Rotation
Post by: @rjen on February 22, 2018, 04:14:09 AM
Tested, and looking good.

In the explanation you may also want to update the option descriptions?

It still reads:

Quote
Manual Rotation Options
o No Change
o Horizontal Flip
o Rotate 180 degrees
o Vertical Flip
o Vertical Flip, Rotate 270 degrees clockwise. (90 degrees counter-clockwise)
o Rotate 270 degrees clockwise. (90 degrees counter-clockwise)
o Horizontal Flip, Rotate 270 degrees clockwise. (90 degrees counter-clockwise)
o Rotate 90 degrees clockwise.

May be changed to:

o No Change
o Rotate 90 degrees Right
o Rotate 90 degrees Left.
o Rotate 180 degrees
o Horizontal Flip
o Vertical Flip
o Horizontal Flip, Rotate 90 degrees Right
o Vertical Flip, Rotate 90 degrees Right

Find attached the language file for Dutch..
Title: Re: Automatic Attachment Rotation
Post by: GL700Wing on February 22, 2018, 04:26:48 AM
May be changed to:

o No Change
o Rotate 90 degrees Right
o Rotate 90 degrees Left.
o Rotate 180 degrees
o Horizontal Flip
o Vertical Flip
o Horizontal Flip, Rotate 90 degrees Right
o Vertical Flip, Rotate 90 degrees Right

It may even be possible to use the 'degrees' symbol ...
o No Change
o Rotate 90° Right
o Rotate 90° Left
o Rotate 180°
o Horizontal Flip
o Vertical Flip
o Horizontal Flip, Rotate 90° Right
o Vertical Flip, Rotate 90° Right
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on February 22, 2018, 09:41:51 AM
Uploaded v3.12 - February 22nd, 2018
o Added Dutch translation, courtsey of @rjen (https://www.simplemachines.org/community/index.php?action=profile;u=287786)!
o 2nd attempt: Changed order of rotation/flip strings in templates, per GL700Wing (https://www.simplemachines.org/community/index.php?action=profile;u=112942)'s post above.
o Changed documentation to reflect new order of manual rotation options.



@rjen:  Thank you for the translation!  It's been included in this version!  I've also "reeditted" the install XML files so that the option-order changes are present, cause I'm not sure if they got into the last version....

EDIT:  I finally saw what you were talking about: it's in the documentation....  It's been fixed!  Thanks!
Title: Re: Automatic Attachment Rotation
Post by: The QE2 Story Forum on March 18, 2018, 10:20:38 AM
Installed and working on 2.0.15.  Thank you.

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.
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on March 29, 2018, 12:13:00 PM
Uploaded v4.0 - March 27th, 2018
o Per GL700Wing (https://www.simplemachines.org/community/index.php?action=profile;u=112942), fixed issue where images with very large dimensions could not be rotated (Image Processing Memory Limit (http://custom.simplemachines.org/mods/index.php?mod=4111) mod may also be required if issue persists).
o Per GL700Wing (https://www.simplemachines.org/community/index.php?action=profile;u=112942), code added to automatically resize images in new and existing topics.
o Per GL700Wing (https://www.simplemachines.org/community/index.php?action=profile;u=112942), added automatic rotation and automatic resize for images in PMs if 'PM Attachments' (https://custom.simplemachines.org/mods/index.php?mod=1974) mod is installed.



@GL700Wing:  Thank you for the new version!  It's been converted for use with SMF 2.1 Beta 3, as well!

@The QE2 Story Forum:  I'm not sure where you are talking about.  Are you talking about the admin area?
Title: Re: Automatic Attachment Rotation
Post by: The QE2 Story Forum on March 30, 2018, 11:48:13 AM
Hi there,

I uninstalled 3.12, and tried to install 4.0, but it has failed because the following line in subs-graphics is different on my installation.  I believe this is because I am also using the "Resize Attached Images" mod.

Code: [Select]
$success = imagejpeg($dst_img, $destName, min($modSettings['attachment_image_compression'], 100));

For now, I've re-installed 3.12 again.

Cheers,

- Rob
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on March 30, 2018, 12:31:59 PM
@The QE2 Story Forum: The installation readme notes that the Resize Attached Images mod should NOT be installed prior to the installation of this mod, as they contain similar, but not the same, functionality....  IMO, this should imply that if you have it installed, you should uninstall it before installing this mod...
Title: Re: Automatic Attachment Rotation
Post by: The QE2 Story Forum on April 01, 2018, 10:08:46 AM
@The QE2 Story Forum: The installation readme notes that the Resize Attached Images mod should NOT be installed prior to the installation of this mod, as they contain similar, but not the same, functionality....  IMO, this should imply that if you have it installed, you should uninstall it before installing this mod...

Thank you for replying, and sorry for not reading the instructions properly!   OK so I uninstalled 3.12 version of this mod, and then I uninstalled "resize attached images" too... then I reinstalled version 4 of this mod and - all is well!  Thank you!
Title: Re: Automatic Attachment Rotation
Post by: The QE2 Story Forum on April 02, 2018, 08:46:50 AM
Just a note - I'm having terrible problems with this now I'm afraid.   It doesn't mean that I don't recommend it to others, just that its caused me a lot of bother overall.

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...

https://www.theqe2story.com/forum/index.php?action=admin;area=manageattachments;sa=browse;sort=date;desc
2: filemtime(): stat failed for /home/robligh/public_html/forum/attachments/57406_a5e04f2e038e80b207c22b83c11a78a07b0bd6c4
File: /home/robligh/public_html/forum/Sources/ManageAttachments.php(383) : runtime-created function
Line: 17

Title: Re: Automatic Attachment Rotation
Post by: GL700Wing 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 (http://custom.simplemachines.org/mods/index.php?mod=4111) mod installed and, if so, how much memory is it configured with?
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh 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 (https://www.simplemachines.org/community/index.php?action=profile;u=112942), 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....
Title: Re: Automatic Attachment Rotation
Post by: 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?
Title: Re: Automatic Attachment Rotation
Post by: GL700Wing 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.
Title: Re: Automatic Attachment Rotation
Post by: Fat Rat on April 02, 2018, 06:41:23 PM
You are a star, thank you.
Title: Re: Automatic Attachment Rotation
Post by: GL700Wing 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'
Title: Re: Automatic Attachment Rotation
Post by: GL700Wing 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?';
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh on April 03, 2018, 05:46:23 PM
Uploaded v4.2 - April 3rd, 2018
o Per GL700's post (https://www.simplemachines.org/community/index.php?topic=544111.msg3967893#msg3967893), fixed syntax error in Subs-AutoRotation.php.
o Per GL700's post (https://www.simplemachines.org/community/index.php?topic=544111.msg3967928#msg3967928), fixed issue where same message for rotating images as deleting images.
o Per GL700Wing (https://www.simplemachines.org/community/index.php?action=profile;u=112942), 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....
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh 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 (https://www.simplemachines.org/community/index.php?action=profile;u=112942), changed required for Image Processing Memory Limit mod was made.
o Per GL700Wing (https://www.simplemachines.org/community/index.php?action=profile;u=112942), 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....
Title: Re: Automatic Attachment Rotation
Post by: Fat Rat on April 06, 2018, 08:55:41 AM
I uploaded 4.2 and didn't install because of the following errors?

Title: Re: Automatic Attachment Rotation
Post by: Sh@mbles 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.
Title: Re: Automatic Attachment Rotation
Post by: GL700Wing 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 (https://www.simplemachines.org/community/index.php?action=profile;u=253913) 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.
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh 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)
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh 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 (https://www.simplemachines.org/community/index.php?action=profile;u=112942), added JPEQ quality check to prevent unnecessary image resizing.
o Per GL700Wing (https://www.simplemachines.org/community/index.php?action=profile;u=112942), fixed code to prevent converting to JPEG when admin option unchecked.
o Per GL700Wing (https://www.simplemachines.org/community/index.php?action=profile;u=112942), added option to disable automatic image rotation.
o Per GL700Wing (https://www.simplemachines.org/community/index.php?action=profile;u=112942), 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!
Title: Re: Automatic Attachment Rotation
Post by: dougiefresh 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 (https://www.simplemachines.org/community/index.php?action=profile;u=112942), added option to disable automatic image rotation FOR EXISTING IMAGES.
o Per GL700Wing (https://www.simplemachines.org/community/index.php?action=profile;u=112942), fixed default JPEG quality value to be 100 instead of 0.
o Per GL700Wing (https://www.simplemachines.org/community/index.php?action=profile;u=112942), added mime type test prior to check for orientation.
Title: Re: Automatic Attachment Rotation
Post by: @rjen 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);
}
Title: Re: Automatic Attachment Rotation
Post by: @rjen 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?
Title: Re: Automatic Attachment Rotation
Post by: The QE2 Story Forum 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.
Title: Re: Automatic Attachment Rotation
Post by: @rjen 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...
Title: Re: Automatic Attachment Rotation
Post by: GL700Wing on April 09, 2018, 01:22:08 AM
Uploaded v4.6 - April 8th, 2018
o Per @rjen's post (https://www.simplemachines.org/community/index.php?topic=544111.msg3968596#msg3968596) 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.
Title: Re: Automatic Attachment Rotation
Post by: GL700Wing on April 09, 2018, 01:23:32 AM
Prior to v4.x of this mod 'white screen of death' issues were still encountered with JPEG images that had very large dimensions and which needed to be rotated (and even installing the Image Processing Memory Limit (https://custom.simplemachines.org/mods/index.php?mod=4111) mod and configuring it to use 512M of memory didn't resolve the issue) - the only fix for this issue is to resize JPEG images before attempting to rotate them.



Similar functionality ? It seems to be mostly the same code! Even the text strings are the same...
Some of the functionality/text strings is/are the same but there are some important differences between this mod and Resize Attached Images (https://custom.simplemachines.org/mods/index.php?mod=2206) - particularly in relation to how 'Resize existing images' works (this is done in ./Sources/Display.php).

The Resize Attached Images (https://custom.simplemachines.org/mods/index.php?mod=2206) mod has the following shortcomings in relation to the processing of existing images:
1.  It does not reformat non-JPEG images to JPEG unless 'Resize existing images' is also enabled;
2.  It does not apply a reduction in JPEQ quality unless the image width/height are greater than max width/height; and
3.  It converts non-JPEG images to JPEG when image attachment width/height are greater than max width/height even if 'Reformat non-JPEG images to JPEG' is disabled.

Finally, this mod fully integrates rotating and/or resizing images in topics and, if the PM Attachments (https://custom.simplemachines.org/mods/index.php?mod=1974) mod is already installed, also in PMs.



I'd like to apologise for the inconvenience that has been caused by the number of updates this mod has been through in the last 10 days - dougiefresh (https://www.simplemachines.org/community/index.php?action=profile;u=253913) and I have been working together to integrate the resizing functionality (which I have had working in a slightly different format on my forums for almost a year) with the 'Automatic Attachment Rotation' mod and obviously we've encountered a few issues along the way.

That said, I am confident the latest version will work as expected/intended.
Title: Re: Automatic Attachment Rotation
Post by: @rjen on April 09, 2018, 05:46:03 AM
I will do some testing with the latest package in my Test system.

In the meantime I have updated the Dutch Language files (with the strings I already translated for the other MOD  ;D ). Find these attached...
Title: Re: Automatic Attachment Rotation
Post by: @rjen on April 11, 2018, 05:28:49 PM
The MOD is working fine and I have applied it for productive use where it has been for a few days, no errors reported and all seems OK.

I do have a few recommendations though:
1. The UTF8 language files for English are missing in the install package: those should really be included. (same applies to the Inline Attachments MOD)

2. I find that there is an annoying 'feature':

When I go to 'browse files' in the admin section there is the function added to Rotate / Flip the file
Next to this option are the standard checkboxes to select multiple files.

Now when I use the checkbox and Click on the Flip/Rotate Images Button, the image is actually DELETED! Regardless of wether or not the checkbox is selected: it should only cause the selected processing option to be executed...
That is pretty dangerous.

In my opinion clicking the Flip/Rotate button should NEVER cause an image to be deleted!
Title: Re: Automatic Attachment Rotation
Post by: GL700Wing on April 11, 2018, 11:20:45 PM
Uploaded v4.7 - April 12th, 2018
o Updated Dutch translation courtsey of @rjen (https://www.simplemachines.org/community/index.php?action=profile;u=287786)
o As per @rjen's post (https://www.simplemachines.org/community/index.php?topic=544111.msg3968843#msg3968843) included English UTF8 language file.
o As per @rjen's post (https://www.simplemachines.org/community/index.php?topic=544111.msg3968843#msg3968843) fixed issue where attachment is deleted when checkbox for deleting attachment is selected and Rotate/Flip Images button is clicked.
o Some code tidy-up in ./Sources/Display.php for JPEG Quailty processing.



@rjen : (https://www.simplemachines.org/community/index.php?action=profile;u=287786) Thanks for the Dutch language files and bug report.
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: GL700Wing on April 26, 2018, 07:58:37 PM
Uploaded v5.0 - April 27th, 2018
o Added option for resizing existing images in either manual or batch mode.
o Changed code to only display rotate/flip options for image attachments when modifying a post.
o Fixed problem with readme file that was causing it not to display during package installation.
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: @rjen on April 27, 2018, 11:22:07 AM
In the new admin option to Resize Existing Images  a list is presented of images to be processed.

Two problems with the list:

1. This list cannot be sorted (by any column)
2. The browse pages option does not function: even though the page number changes, the listed images remain unchanged...

Title: Re: Automatic Attachment Rotation (and Resize)
Post by: @rjen on April 27, 2018, 12:31:38 PM
In addition: I was looking at the new text strings to add these to the dutch language files.

Now I am confused: as part of the install package you have included an additonal text file : ResizeExistingImages.english.php and ResizeExistingImages.english-utf8.php, but the install file is also adding the same text strings to Modifications.english.php!

It seems that this is not intentional... can you please correct this?

I will provide the dutch files if the files are the correct way...
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: The QE2 Story Forum on April 27, 2018, 01:03:07 PM
Hi,

I've just installed v5.0 after giving you a few weeks to iron out your niggles, and so far so good.  I'll feed back again in a few days if I see any issue (or not).

Keep up the good work (but don't go overboard and make this mod too large and complex!!)

Cheers,

- Rob
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: GL700Wing on April 27, 2018, 11:49:26 PM
Uploaded v5.1 - April 28th, 2018
o Per @rjen (https://www.simplemachines.org/community/index.php?topic=525705.msg3970385#msg3970385) - fixed issue that prevented Post and PM Inline Attachment (https://custom.simplemachines.org/mods/index.php?mod=3770) inline attachment numbers from being incremented when modifying a post.
o Per @rjen (https://www.simplemachines.org/community/index.php?topic=544111.msg3970388#msg3970388) - fixed issues with sorting and browsing list of images to be resized/reformatted.
o Per @rjen (https://www.simplemachines.org/community/index.php?topic=544111.msg3970392#msg3970392) - load required language file rather than add text strings to other language files.



Thanks @rjen (https://www.simplemachines.org/community/index.php?action=profile;u=287786) for the bug reports.

In relation to the adding of the text strings to the Modifications.english.php file : this was the approach taken in the mod I based the manual/batch resizing code on.  That said, I have now updated the code in this mod to load the required language file instead.

Quote
I will provide the dutch files if the files are the correct way...
Thanks - if you provide the ResizeExistingImages.dutch.php and ResizeExistingImages.dutch-utf8.php files I'll add them to the next release.
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: GL700Wing on April 28, 2018, 12:05:20 AM
I've just installed v5.0 after giving you a few weeks to iron out your niggles, and so far so good.  I'll feed back again in a few days if I see any issue (or not).
Thanks - I've just uploaded v5.1 so you can try that version now!  ;)

Quote
Keep up the good work (but don't go overboard and make this mod too large and complex!!)
I don't think much more functionality will be added to this mod.

That said I know that having the option to resize existing image attachments (using manual and/or batch processing modes) is really important for forums that have not previously implemented image attachment dimension/filesize restrictions for several reasons:
1. Smaller image attachment filesizes will result in posts that load more quickly;
2. Reducing the filesize of image attachments has the potential to significantly reduce the disk space used by attachments; and
3. Probably no so important but less website bandwidth will be used.
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: @rjen on April 28, 2018, 03:36:37 AM
Thanks for sorting out the language strings. Find attached the missing dutch files...

Small problem with the links to images in the list.
For most images the link works: it brings me directly to the image in the post. For some the link brings me to the first message in the post...

I noticed that the link under the standard option (Browse files > Attachments) always work.
Theze are formatted as such:
https://test.fjr-club.nl/index.php?topic=14573.msg257357#msg257357
https://test.fjr-club.nl/index.php?topic=14573.msg213612#msg213612

The links in the new list (Browse files > Resize Existing Images) are formatted as below:
https://test.fjr-club.nl/index.php?topic=14573.0.msg257357#msg257357
https://test.fjr-club.nl/index.php?topic=14573.0.msg213612#msg213612

These links do not always work. It seems to be related the length of the topics: in a long topic it does not work correctly..

It seems to be caused by the .0 added after the topic ID..
?topic=14573.0.msg


Apart from that the packages seems to be fine.
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: GL700Wing on April 28, 2018, 05:22:14 AM
V5.2 - April 28th, 2018
o Per @rjen (https://www.simplemachines.org/community/index.php?topic=544111.msg3970435#msg3970435) - fixed image and post links for images in Browse files > Resize Existing Images list.
o Per @rjen (https://www.simplemachines.org/community/index.php?topic=544111.msg3970435#msg3970435) - added Dutch language files.



@rjen (https://www.simplemachines.org/community/index.php?action=profile;u=287786) - Many thanks for your testing and feedback - I really appreciate it!
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: The QE2 Story Forum on April 28, 2018, 05:44:41 AM
Hi there,

I woke up to lots of errors in my forum, and have uninstalled this again (v 5.0).  Do you think, from looking below, that 5.2 will resolve this?  I have uninstalled 5.0 and installed 5.2.

This was the first error, from a guest

Code: [Select]
https://www.theqe2story.com/forum/index.php?/topic,8446.0.html
The database value you're trying to insert does not exist: width
Function: loadAttachmentContext
File: /public_html/forum/Sources/Display.php
Line: 1584
Then followed by hundreds of errors from everyone when accessing that topic.

Code: [Select]
2: rename(/home/robligh/public_html/forum/attachments/58323_58fd5a2be5327a3ac9844bdf2b5c8440a0a01323.temp,/home/robligh/public_html/forum/attachments/58323_58fd5a2be5327a3ac9844bdf2b5c8440a0a01323): No such file or directory
File: /home/robligh/public_html/forum/Sources/Display.php
Line: 1542

Code: [Select]
2: getimagesize(/home/robligh/public_html/forum/attachments/58323_58fd5a2be5327a3ac9844bdf2b5c8440a0a01323): failed to open stream: No such file or directory
File: /home/robligh/public_html/forum/Sources/Display.php
Line: 1545

Code: [Select]
https://www.theqe2story.com/forum/index.php?/topic,8446.0.html
2: filesize(): stat failed for /home/robligh/public_html/forum/attachments/58323_58fd5a2be5327a3ac9844bdf2b5c8440a0a01323
File: /home/robligh/public_html/forum/Sources/Display.php
Line: 1548

Thanks.
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: The QE2 Story Forum on April 28, 2018, 06:23:17 AM
Second, separate feedback.

Now on 5.2.

Someone has managed to upload a huge 10mb photo - 6000x4000 px.  I've tried to use the resize existing images feature to shrink this down, but it seems to just ignore me when I try - doesn't do anything, and no error logged either.   If its any help, this is the post with the huge image on it - https://www.theqe2story.com/forum/index.php/topic,8333.msg96611.html#msg96611

Title: Re: Automatic Attachment Rotation (and Resize)
Post by: GL700Wing on April 28, 2018, 09:10:20 AM
Someone has managed to upload a huge 10mb photo - 6000x4000 px.  I've tried to use the resize existing images feature to shrink this down, but it seems to just ignore me when I try - doesn't do anything, and no error logged either.
Have you checked the error_log file on the server to see if it contains any error messages?

Quote
If its any help, this is the post with the huge image on it - https://www.theqe2story.com/forum/index.php/topic,8333.msg96611.html#msg96611
I've downloaded that photo and tested the following scenarios on my test forum and the image is successfully resized to 1024x682 with a filesize of ~57Kb every time:

Scenario One:
1. The following Attachment Settings all saved as blank: 'Max attachment size per post', 'Max size per attachment', 'JPEG quality factor', 'Maximum width of attached images' and 'Maximum height of attached images'.
2.  The Attachment Setting 'Resize existing images' is disabled.
3. The 10Mb/6000x4000Px photo is attached to a post - the image information shows the photo is 10715.44 kB, 6000x4000.
4. The following Attachment Settings are configured using values shown at the end of this post: 'Max attachment size per post', 'Max size per attachment', 'JPEG quality factor', 'Maximum width of attached images' and 'Maximum height of attached images'
5. The image attachment is selected from the Admin -> Attachments and Avatars -> Browse Files -> Resize Existing Images list and successfully resized by clicking on 'Resize Existing Images'/'Resize and/or Reformat Existing Images'.

Scenario Two:
1. The following Attachment Settings all saved as blank: 'Max attachment size per post', 'Max size per attachment', 'JPEG quality factor', 'Maximum width of attached images' and 'Maximum height of attached images'.
2.  The Attachment Setting 'Resize existing images' is disabled.
3. The 10Mb/6000x4000Px photo is attached to a post - the image information shows the photo is 10715.44 kB, 6000x4000.
4. The following Attachment Settings are configured using values shown at the end of this post: 'Max attachment size per post', 'Max size per attachment', 'JPEG quality factor', 'Maximum width of attached images' and 'Maximum height of attached images'
5. The Attachment Setting 'Resize existing images' is enabled.
6. The image attachment is automatically resized the next time the post containing the image is displayed.

Scenario Three:
1. The following Attachment Settings are configured using values shown at the end of this post: 'Max attachment size per post', 'Max size per attachment', 'JPEG quality factor', 'Maximum width of attached images' and 'Maximum height of attached images'
2. The Attachment Setting 'Resize existing images' is enabled.
3. The 10Mb/6000x4000Px photo is attached to a post  - the image information is automatically resized when the post is saved.



The fact that the image is being shown in the list of images that can be resized indicates that you have configured at least some of the following Attachment Settings:  'Max attachment size per post', 'Max size per attachment', 'JPEG quality factor', 'Maximum width of attached images' and 'Maximum height of attached images' - you should also make sure the Attachment Setting 'Resize existing images' is enabled.

Given that the photo resizes correctly on my test forum with three different scenarios (and no error messages) the only other thing I can suggest you try is to save the photo to your own computer, edit the topic and clear the checkbox for the existing image attachment and attach the photo as a new attachment.


Suggested Attachment Settings:
Max attachment size per post: 2048
Max size per attachment: 1024
JPEG quality factor: 80
Maximum width of attached images: 1024
Maximum height of attached images:1024

Title: Re: Automatic Attachment Rotation (and Resize)
Post by: GL700Wing on April 28, 2018, 09:18:42 AM
I woke up to lots of errors in my forum, and have uninstalled this again (v 5.0).  Do you think, from looking below, that 5.2 will resolve this?  I have uninstalled 5.0 and installed 5.2.
I suspect those error messages are being generated because the Attachment Setting 'Resize existing images' is enabled and there is a missing or corrupted image attachment -  Admin => Forum => Attachments and Avatars => File Maintenance => Attachment Integrity Check should be run and issues corrected.

If the errors persist disable the Attachment Setting 'Resize existing images'.
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: The QE2 Story Forum on April 28, 2018, 09:39:07 AM
Thanks for replying/trying to help.

OK so ....

I have max attachment size per post and max size per attachment deliberately set to 0 (disable) to allow my very non-technical forum users to upload big files.  I don't want it stopping them trying to upload a big photo, I just want it to shrink it down without htem knowing what its doing.  If i set these to 1024/2048 as you suggest, I can't upload that big image at all.

I did have resize existing imagest ticked.

And I've had JPEG quality set to 85, and max height/width both at 1280 for a long time.

I can't see any errors at all on the server, it just stubbornly refuses to do anything to this particular photo!
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: GL700Wing on April 28, 2018, 10:07:40 AM
I have max attachment size per post and max size per attachment deliberately set to 0 (disable) to allow my very non-technical forum users to upload big files.  ...  If i set these to 1024/2048 as you suggest, I can't upload that big image at all.
That's really interesting because I can definitely upload that big image with those settings (ie, Max attachment size per post: 2048 and Max size per attachment: 1024) and the reason for this is that the attachment size is checked after the image has been resized.

I'll send you a PM with details of a login you can use on my test forum (which is a recent copy of my production forum) so that you can try with that big image yourself (you can either create a new topic or reply to an existing one).



FYI: My test forum is configured with the following Attachment Settings:
Max attachment size per post: 2048
Max size per attachment: 1024
Reformat non-JPEG images to JPEG: Enabled
Resize existing images: Enabled
JPEG quality factor: 80
Maximum width of attached images: 1024
Maximum height of attached images:1024
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: The QE2 Story Forum on April 28, 2018, 10:10:42 AM
That's really interesting because I can definitely upload that big image with those settings (ie, Max attachment size per post: 2048 and Max size per attachment: 1024) and the reason for this is that the attachment size is checked after the image has been resized.

Hi.  I did wonder about that, which is why I did the test - it sounds like my forum/server is simply not managing to resize that image (by whatever method), but does manage to upload it OK.
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: GL700Wing on April 28, 2018, 10:34:47 AM
That's really interesting because I can definitely upload that big image with those settings (ie, Max attachment size per post: 2048 and Max size per attachment: 1024) and the reason for this is that the attachment size is checked after the image has been resized.

Hi.  I did wonder about that, which is why I did the test - it sounds like my forum/server is simply not managing to resize that image (by whatever method), but does manage to upload it OK.
The forum I’ve been using to test/check the resizing of your large photo is running SMF 2.0.15 and has 135 mods (including this one) installed plus lots of other customisations.

I’m beginning to wonder if you have a conflicting mod installed or if an earlier version of this mod or a mod like Resize Attached Images (https://custom.simplemachines.org/mods/index.php?mod=2206) did not uninstall fully/correctly.
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: The QE2 Story Forum on April 28, 2018, 11:08:01 AM
I've also now spotted another corrupt (missing) image in my error log - seems to be happening at random.  The thumbnail is still there, but the image attachment has gone.  This wasn't happening (ever) when I only had Resize Attached Images installed.   In the attachments folder, instead of the file, is one with the same name, with .temp at the end, and zero bytes.

Title: Re: Automatic Attachment Rotation (and Resize)
Post by: GL700Wing on April 28, 2018, 11:33:00 AM
I've also now spotted another corrupt (missing) image in my error log - seems to be happening at random.  The thumbnail is still there, but the image attachment has gone.  This wasn't happening (ever) when I only had Resize Attached Images installed.   In the attachments folder, instead of the file, is one with the same name, with .temp at the end, and zero bytes.
Have you run Admin => Forum => Attachments and Avatars => File Maintenance => Attachment Integrity Check and corrected any issues it has found?

Do you know if the corrupt/missing image was originally a JPG image or was it some other image type (eg, PNG, GIF, etc)?

Did you have the ‘Resize Existing Images’ option enabled with the “Resize Attached Images” mod?



The ‘.temp’ file is created when the original image is resized but at that point both image files exist (ie, the original image file and the resized copy with the ‘.temp’ extension) and the ‘.temp’ file is renamed to the original file name only if the resizing was successful.  As such there shouldn’t be any ‘.temp’ files.  I suggest you disable the ‘Resize Existing Images’ option while I investigate further.

I also originally had “Resize Attached Images” mod installed but I haven’t encountered the issues you’re reporting and my forum has more than 8,000 image attachments (which I resized on my test forum using this mod).
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: The QE2 Story Forum on April 28, 2018, 11:47:07 AM
This mod is causing me to lose attachments.  I've now uninstalled it, and reverted to the Resize Attached Images, which has never caused such a problem.

The integrity check does highlight issues (due to the images this mod is causing me to lose) but was coming up clean before I tried it again.

I'm sure it isn't happening in ever case (or I'd have lost loads more images) - no idea what the pattern is.  Yes they're all JPGs.

Thanks for your help, but thats me giving up again.
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: GL700Wing on April 28, 2018, 11:55:27 AM
This mod is causing me to lose attachments.  I've now uninstalled it, and reverted to the Resize Attached Images, which has never caused such a problem.

The integrity check does highlight issues (due to the images this mod is causing me to lose) but was coming up clean before I tried it again.

I'm sure it isn't happening in ever case (or I'd have lost loads more images) - no idea what the pattern is.  Yes they're all JPGs.

Thanks for your help, but thats me giving up again.
If you disable the ‘Resize Existing Images’ option this mod will not touch images in existing posts.

I’ll do further testing and checking but given this mod is not working properly on your forum anyway I don’t know if I’ll be able to solve these issues.  Do you have a test forum that is a copy of your current production forum where you test/check mods?
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: @rjen on April 28, 2018, 03:06:33 PM
I verified the working of the mod including the Batch task on a test site and It all seems allright, moved it into productive use.

When testing I  got to a better understanding of the working of the process and consequently I had to update some of the dutch language strings to better reflect the correct function. This includes a special note in string $txt['resize_images_desc'] to explain that the list of files for Resize Existing Images only displays images that qualify for resizing under the current settings.

I would suggest including that explanation in the English file too in a future version of the mod...

Title: Re: Automatic Attachment Rotation (and Resize)
Post by: dougiefresh on April 28, 2018, 05:06:18 PM
Sorry, I've been dealing with some issues lately and haven't been following the forum as closely as I suppose I should have....  I'll take a look into the reports...
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: GL700Wing on April 30, 2018, 05:23:27 AM
V5.3 - April 30th, 2018
o Per @rjen (https://www.simplemachines.org/community/index.php?topic=544111.msg3970490#msg3970490) - updated Dutch language files for 'Resize Exisitng Images'.
o Updated English language files for 'Resize Exisitng Images' to provide more detailed description for manual/batch options.
o Changed behaviour of automatic image resizing when displaying a post so that images are only resized if 'Resize existing images' is selected (in previous versions of this mod they were also resized when 'Reformat non-JPEG images to JPEG' was selected).
o Resolved issue that was causing image files saved with '_JPG' in their filename to be incorrectly renamed to '_jpg' in the database (this only affected image attachments created with SMF 1.x).
o Added option to keep backup of original image file when Attachment Setting 'Resize exisitng images' is enabled.
o Updated image resizing code for automatic, manual and batch resizing modes to create backup of the original image file and restore it if the new image file is empty.



@rjen (https://www.simplemachines.org/community/index.php?action=profile;u=287786) : Thanks for the updated Dutch language files - two new text strings have been added to AutoRotation.dutch.php/AutoRotation.dutch-utf8.php.
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: @rjen on April 30, 2018, 02:40:01 PM
@rjen (https://www.simplemachines.org/community/index.php?action=profile;u=287786) : Thanks for the updated Dutch language files - two new text strings have been added to AutoRotation.dutch.php/AutoRotation.dutch-utf8.php.

Updated files attached...
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: Rock Lee on April 30, 2018, 08:02:05 PM
I have a doubt with the phrase "...image file will be kept in the <i>attachmentsPreREI<i> directory." is the SMF default folder? I do not have my computer at hand to test what it refers to (if I realize the doubts of some translations). I want to thank you for the effort to update both the modification, it denotes a lot of appreciation to collaborate. Now I'm having problems with the internet, but as soon as I finish and check my translations, I'll update the updated versions.


Regards!
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: GL700Wing on April 30, 2018, 09:59:12 PM
I have a doubt with the phrase "...image file will be kept in the <i>attachmentsPreREI<i> directory." is the SMF default folder?
The directory/folder name should have been shown in italics (ie, attachmentsPreREI) so I have fixed that text formatting in the language files.
Also, the directory/folder 'attachmentsPreREI' is created in the default SMF forum directory/folder (ie, in the same directory/folder as the 'attachments' directory/folder) so I've updated the help text/description to include this information.

Quote
I want to thank you for the effort to update both the modification, it denotes a lot of appreciation to collaborate.
Thank you - I'm very grateful to @dougiefresh (https://www.simplemachines.org/community/index.php?action=profile;u=253913) for the great mods he has developed and for allowing me to work on this mod.
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: GL700Wing on April 30, 2018, 10:04:07 PM
V5.4 - May 1st, 2018
o Per @rjen (https://www.simplemachines.org/community/index.php?topic=544111.msg3970720#msg3970720) - updated Dutch language files.
o Per Rock Lee (https://www.simplemachines.org/community/index.php?topic=544111.msg3970759#msg3970759) - fixed text formatting error for attachmentsPreREI directory name text string in language files and updated help text/description relating to the saving of original image files to the attachmentsPreREI directory.



@rjen (https://www.simplemachines.org/community/index.php?action=profile;u=287786) : Thanks for the updated Dutch language files.
Rock Lee (https://www.simplemachines.org/community/index.php?action=profile;u=322597) : Thanks for the feedback.
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: Rock Lee on May 01, 2018, 06:21:29 PM
No problem @GL700Wing I leave the improved translations in some points I saw were loose also fix some errors overlooked. Likewise, anything you tell me :P and thanks for so much (I already have to go through your web there are several mod I have the translations @dougiefresh I'm only in a public network and I hesitate to login but I'll be able to do it and I'll help you with several vi's that are not published here).


Regards!
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: The QE2 Story Forum on May 06, 2018, 06:17:33 AM
OK so reinstalled just now.  Installed with no errors.

Have set it up as per the attached.

I immediately went to an image that was uploaded a few days ago, that had appeared upside down.  I did modify post, rotate 180 degrees, and I it only rotated the thumbnail.... when I click the thumbnail, the full photo is still the wrong way around.  ..

Title: Re: Automatic Attachment Rotation (and Resize)
Post by: Tonyvic on May 06, 2018, 07:15:31 AM
I see from your attachment I note that 'Re-encode potentially dangerous image attachments' is active.
I don't ues the Mod but could it be due to
Quote
NOTE: SMF contains an option called Re-encode potentially dangerous image attachments, which is turned on by default.  This re-encoding removes the orientation information from attachments (amongst other things), which means attachments uploaded prior to this mod being installed will NOT be able to rotated properly, as the EXIF information is missing from the re-encoded attachment file!
which is stated on the Mod page?
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: The QE2 Story Forum on May 06, 2018, 12:03:51 PM
Thanks. My mistake!  Yes it seems happier now...
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: GL700Wing on May 07, 2018, 09:08:09 AM
V5.5 - May 7th, 2018
o Per Rock Lee (https://www.simplemachines.org/community/index.php?topic=544111.msg3970888#msg3970888) - updated/added Spanish langage files.
o Per The QE2 Story Forum (https://www.simplemachines.org/community/index.php?topic=544111.msg3971411#msg3971411) and Tonyvic (https://www.simplemachines.org/community/index.php?topic=544111.msg3971413#msg3971413) - added note about "Attachment Settings => Re-encode potentially dangerous image attachments" setting in relation to this mod.
o Resolved issue where correct JPEG Quality value was not always being stored in database.



Rock Lee (https://www.simplemachines.org/community/index.php?action=profile;u=322597) : Thanks for updated/new Spanish language files.
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: The QE2 Story Forum on May 15, 2018, 05:13:19 AM
Hello!  Its me again.

Something odd... I've changed host (although its very similar technically), and after i did so, every JPG image was white-screening immediately on upload.

I uninstalled this mod, and the memory limit one, and then re-installed the memory limit mod, and then this one (v5.5) and it started working again.

However, if automatic rotate is turned on , I get the white-screen again.  If I turn auto-rotate off, it works.

Manual image rotation works fine, even with a very large 4.5mb 5152x3864 pixels image.

Thanks for any suggestions.

Title: Re: Automatic Attachment Rotation (and Resize)
Post by: GL700Wing on May 15, 2018, 06:44:11 AM
Hello!  Its me again.

Something odd... I've changed host (although its very similar technically), and after i did so, every JPG image was white-screening immediately on upload.

I uninstalled this mod, and the memory limit one, and then re-installed the memory limit mod, and then this one (v5.5) and it started working again.

However, if automatic rotate is turned on , I get the white-screen again.  If I turn auto-rotate off, it works.

Manual image rotation works fine, even with a very large 4.5mb 5152x3864 pixels image.

Thanks for any suggestions.
Have you tried increasing the memory allocated via the "Image Processing Memory Limit" mod? 

I'm using 256 for one forum and 512 for another (it's a higher spec shared server) and neither have issues with auto-rotation.
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: The QE2 Story Forum on May 15, 2018, 09:04:01 AM
Hello!  Its me again.

Something odd... I've changed host (although its very similar technically), and after i did so, every JPG image was white-screening immediately on upload.

I uninstalled this mod, and the memory limit one, and then re-installed the memory limit mod, and then this one (v5.5) and it started working again.

However, if automatic rotate is turned on , I get the white-screen again.  If I turn auto-rotate off, it works.

Manual image rotation works fine, even with a very large 4.5mb 5152x3864 pixels image.

Thanks for any suggestions.
Have you tried increasing the memory allocated via the "Image Processing Memory Limit" mod? 

I'm using 256 for one forum and 512 for another (it's a higher spec shared server) and neither have issues with auto-rotation.

Hi.. Thanks.  It was at 128, I've tried 256 and 512 but it still does the same thing.  As soon as I turn off "automatically rotate" it lets it upload, and I can then still manually rotate it no problem (in fact it does it instantly)..
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: The QE2 Story Forum on May 15, 2018, 10:41:04 AM
Also seeing this error lots of times, but only for guests :-

https://www.theqe2story.com/forum/index.php?topic=6455.0
8: Undefined variable: mp
File: /home/theqesto/public_html/forum/Sources/Class-exifReader.php
Line: 1201
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: GL700Wing on May 16, 2018, 08:18:21 AM
Hi.. Thanks.  It was at 128, I've tried 256 and 512 but it still does the same thing.  As soon as I turn off "automatically rotate" it lets it upload, and I can then still manually rotate it no problem (in fact it does it instantly)..
Have you tried adjusting the settings in the php.ini file for the forum?

These are the settings I'm using for the forum on the higher spec shared server:
memory_limit = 512M
post_max_size = 64M
upload_max_filesize = 64M

Title: Re: Automatic Attachment Rotation (and Resize)
Post by: GL700Wing on May 16, 2018, 08:27:13 AM
Also seeing this error lots of times, but only for guests :-

https://www.theqe2story.com/forum/index.php?topic=6455.0
8: Undefined variable: mp
File: /home/theqesto/public_html/forum/Sources/Class-exifReader.php
Line: 1201
I've never seen that error and I'm unable to reproduce it but if you make the following change to line 1201 of ./Sources/Class-exifReader.php it should fix the problem:

Find:
Code: [Select]
$this->ImageInfo['h']["customRendered"] = ($mp == 0) ? 'Normal Process' : ($mp == 1 ? 'Custom Process' : 'Reserved');
Replace With:
Code: [Select]
$this->ImageInfo['h']["customRendered"] = (!isset($mp) || $mp == 0) ? 'Normal Process' : ($mp == 1 ? 'Custom Process' : 'Reserved');
The change basically makes 'Normal Process' the default value (and this is actually the default value for "customRendered") if '$mp" has not already been defined.

If you can test/confirm this fix I'll include it in the next version.

Title: Re: Automatic Attachment Rotation (and Resize)
Post by: The QE2 Story Forum on May 17, 2018, 06:04:19 PM
HI there,

I did your suggested change a few hours ago, and am not seeing any errors now.

Cheers,

- Rob
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: GL700Wing on May 17, 2018, 07:06:46 PM
I did your suggested change a few hours ago, and am not seeing any errors now.
Thanks - I'll include this fix in the next update.

BTW - You can leave this fix in place until then as it won't generate any errors in relation to ./Sources/Class-exifReader.php when the current version of the mod is uninstalled as it deletes that file completely.
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: dougiefresh on May 21, 2018, 11:23:12 PM
Uploaded v5.6 - May 21st, 2018
o Fixed undefined variable error in Class-exifReader.php.



Replace With:
Code: [Select]
$this->ImageInfo['h']["customRendered"] = (!isset($mp) || $mp == 0) ? 'Normal Process' : ($mp == 1 ? 'Custom Process' : 'Reserved');
I just looked at the code.  Nowhere else is the $mp variable used.  So it should probably read like this:
Code: [Select]
$this->ImageInfo['h']["customRendered"] = (empty($tmp) ? 'Normal Process' : ($tmp == 1 ? 'Custom Process' : 'Reserved'));The empty function also catches if the variable isn't defined.  When your statement is replaced with my above code, this SHOULDN'T happen....

I've integrated this change into this version.  Hopefully, it'll help with the mod....  :P ::)
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: dan4ever on June 09, 2018, 01:50:46 PM

Hi


Still getting this error:
8: Undefined offset: 9
Fil: /home4/*****/forum/Sources/Display.php
Rad: 1339


Looks like this:
   list ($id_folder, $real_filename, $file_hash, $file_ext, $id_attach, $attachment_type, $mime_type, $is_approved, $id_member, $proper_rotation) = $smcFunc['db_fetch_row']($request);




Something work around maybe?
have 5.5 will upgrade soon


/Dan
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: GL700Wing on June 09, 2018, 08:26:11 PM
Still getting this error:
8: Undefined offset: 9
Fil: /home4/*****/forum/Sources/Display.php
Rad: 1339

Looks like this:
   list ($id_folder, $real_filename, $file_hash, $file_ext, $id_attach, $attachment_type, $mime_type, $is_approved, $id_member, $proper_rotation) = $smcFunc['db_fetch_row']($request);

Does line 1325 (or a line very close to this number) in your ./Sources/Display.php look like this?
Code: [Select]
SELECT a.id_folder, a.filename, a.file_hash, a.fileext, a.id_attach, a.attachment_type, a.mime_type, a.approved, m.id_member, a.proper_rotation
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: dan4ever on June 10, 2018, 07:31:15 AM

Yes!

SELECT a.id_folder, a.filename, a.file_hash, a.fileext, a.id_attach, a.attachment_type, a.mime_type, a.approved, m.id_member, a.proper_rotation


/Dan
Title: Re: Automatic Attachment Rotation (and Resize)
Post by: GL700Wing on June 10, 2018, 07:18:53 PM
Yes!
Ok - we’ll I don’t know why those errors are being generated on your forum.  However, given this issue has not been reported previously you could try uninstalling the version you currently have installed (making to sure to fix any uninstall errors) and then install the latest version.