Additional Info
Type
Package ID
Dougiefresh:AutoRotation
First Created
February 24, 2016, 10:24:14 AM
Last Updated
March 04, 2024, 01:39:21 AM

Automatic Attachment Rotation (and Resize) v6.25

Automatically rotate images to display correctly and/or resize images to reduce image/file size.
Compatible With 2.0.14, 2.0.15, 2.0.17, 2.0.18, 2.0.19, 2.1.1, 2.1.2, 2.1.4
Latest version v6.25
Downloads 2,593
Reviews 0
Rating 0/5
Subscribers 21
License BSD 2-Clause "Simplified" License (View License)



Automatic Attachment Rotation (and Resize)
For SMF 2.0 and SMF 2.1
v6.25


By Dougiefresh and GL700Wing
Link to Mod



Introduction
This mod allows the automatic rotation and/or flipping of JPEG images but only if they contain the relevant EXIF information.

NOTE: SMF contains an option called Re-encode potentially dangerous image attachments, which is enabled 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!!

IMPORTANT NOTE FOR SMF 2.0 In order to fully support the Post and PM Inline Attachments mod you must install this mod after you install that mod!!
Also, if you subsequently need to uninstall the Post and PM Inline Attachments mod you must uninstall this mod first.

IMPORTANT NOTES REGARDING GD AND IMAGICK IMAGE PROCESSING
For SMF 2.0:
o GD is used even if the iMagick extension is enabled in PHP unless this mod is enabled with the 'Use iMagick' setting also enabled.
o EXIF metadata will always be removed from a JPEG image that is resized/compressed even if the 'Remove EXIF data from JPEG images' option is disabled.

For SMF 2.1:
o GD is used if the iMagick extension is not enabled in PHP or if this mod is enabled with the 'Use iMagick' setting disabled.

Major change introduced in v6.20
o Added option to configure and check for allowed image MIME types.

Major changes introduced in v6.12
o Added support for official release of SMF 2.1.
o Removed support for SMF 2.1 RC4.

Major changes introduced in v6.10
o Support for SMF 2.1 RC4 (official release only - not GitHub releases).
o Support for ImageMagick/Imagick image processor.
o Added options for rotating images and thumbnails separately when modifying a message (and for Admins when browsing files via the Admin center).
o Added code to display a thumbnail-sized copy of each attached image (and a smaller version of the real thumbnail if it exists) when editing a message (and for Admins when browsing files via the Admin Center).

Major change introduced in v6.00
o - Support for SMF 2.0.18 and PHP 7.4.

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

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 mod is installed).

Post Screen Changes
Beside each image attachment a dropbox will be displayed listing the following rotation options for the Image/Thumbnail, Image Only and Thumbnail Only:
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 Processing of Existing Images
When a post is displayed, and if the Attachment Setting Automatically process existing images option is enabled, images in the post will be automatically rotated, reformatted and/or resized using the same Attachment Setting options (ie, Automatically rotate JPEG images, Reformat non-JPEG images to JPEG, JPEG quality 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 directory with the extension '.rei'.
Note: Images posted by members who belong to a membergroup that has specific JPEG quality and/or maximum width/height values configured will be resized according to the values configured for that membergroup.


Manual Resizing of Existing Images
This feature, which can be accessed via Admin => Forum => Attachments and Avatars => Browse Files => Automatic Attachment Rotation (and Resize) - Resize, Rotate, and/or Reformat Existing Images, can be used to selectively resize, rotate and/or reformat existing images using the same Attachment Setting options (ie, Automatically rotate JPEG images, Reformat non-JPEG images to JPEG, JPEG quality and/or maximum width/height) that are applied to new image attachments in posts.
Note: Images posted by members who belong to a membergroup that has specific JPEG quality and/or maximum width/height values configured will NOT be resized.


Batch Rotate, Reformat and/or Resize Existing Images
This feature, which can be accessed via Administraton Center => Attachments and Avatars => File Maintenance => Automatic Attachment Rotation (and Resize) - Batch Resize, Rotate, and/or Reformat Existing Images, will resize, rotate and/or reformat ALL existing images using the options configure via Administration Center => Attachments and Avatars => Attachment Settings (ie, "Automatically rotate JPEG images"; "Reformat non-JPEG images to JPEG"; "JPEG quality"; "Maximum width of attached images"; and "Maximum height of attached images").

Note:: Images posted by members who belong to a membergroup that has specific JPEG quality and/or maximum width/height values configured will NOT be resized.

The forum should be configured as follows BEFORE commencing batch resizing:
o Administraton Center => Configuration => Server Settings => General => Enable Maintenance Mode - should be enabled.
o Administraton Center => Configuration => Security and Moderation => General => Disable administration security - should be disabled.
o Administraton Center => Forum => Posts and Topics => Topic Settings => Number of topics per page in the message index - should be configured to between 15 and 25 via (make a note of the current value).
o Administraton Center => Attachments and Avatars => Attachment Settings - configure the following settings: "Automatically rotate JPEG images"; "Reformat non-JPEG images to JPEG"; "JPEG quality"; "Maximum width of attached images"; and "Maximum height of attached images".
o Administraton Center => Attachments and Avatars => File Maintenance => Attachment Integrity Check - should be run and issues corrected.

Important notes for batch resizing:
o JPEG images will only be rotated if the "Automatically rotate JPEG images" option is enabled AND if they contain the relevant orientation metadata.
o Non-JPEG images will only be reformatted to JPEG if the "Reformat non-JPEG images to JPEG" option is enabled.
o The existing 'attachments' database table will be copied to 'attachmentsPreREI' database table. **
o If the image backup option is enabled original image files are saved to the 'attachmentsPreREI' directory/folder. **
o The 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 Administraton Center => Configuration => Security and Moderation => General => Disable administration security - should be enabled.
o Administraton Center => Configuration => Server Settings => General => Enable Maintenance Mode - should be disabled.
o Administraton Center => Forum => Posts and Topics => Topic Settings => Number of topics per page in the message index - should be configured to previous value.


Admin Changes
In Administraton Center => 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 the mod, configure a specific memory limit for image rotation/resizing, configure automatic image rotation and automatic resizing of existing images, enable/disable reformatting/resizing, option to reformat non-JPEG images to JPEG, enable removal of EXIF metadata from JPEG images, and options to set JPEG quality, and maximum width/height values for attached images. Also option to configure different JPEG quality, and maximum width/height values for some membergroups and to enable/disable this feature.
- **File Maintenance**: There is a new section for *Batch Resize Existing Images*. There is also a new section for *Reset Orientation Flag*.
o File Maintenance: There is a new section for Batch Resize, Rotate, and/or Reformat. There is also a new section for Reset Orientation Flag.

Compatibility Notes
This mod was tested on SMF 2.0.17 but should work on SMF 2.0 and up.
This mod is only compatible with the official release of SMF 2.1 RC4 (ie, not GitHub releases).
SMF 1.x is not and will not be supported.

For SMF 2.0 - These mods (not required) must be installed before this mod:
o Post and PM Inline Attachments
o Improved Attachment Error Handling

For SMF 2.0 - The following mod must be uninstalled before installing this mod:
o Resize Attachment Images

For SMF 2.0 - The following mod is no longer required (additional memory for processing images can now be configured within this mod) and should be uninstalled:
o Image Processing Memory Limit

Translators
o Dutch: @rjen
o Spanish Latin: RockLee

Special Credit
This mod relies on the phpExifRW class, which is licensed under the GNU Lesser General Public License, 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, at the Image Orientation thread over at the ElkArte forum, and on GitHub - Recurser.

License
QuoteCopyright (c) 2016-2020, Douglas Orend, 2019-2024 Kathy Leslie
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; and
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.
Automatic_Attachment_Rotation_and_Resize_v6.16.zip
130.26 KB v6.16 2.0.17, 2.0.19, 2.1.1, 2.1.2
Automatic_Attachment_Rotation_and_Resize-v6.25.zip
200.32 KB v6.25 2.0.15, 2.0.17, 2.0.19, 2.1.1, 2.1.3, 2.1.4
Manual installation info
You have to register or login to be able to leave a review
There are currently no reviews on this customization
Advertisement: