News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Automatic Attachment Rotation (and Resize)

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

Previous topic - Next topic

Rob Lightbody

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


GL700Wing

#181
Quote from: 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.
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).
Life doesn't have to be perfect to be wonderful ...

Rob Lightbody

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.

GL700Wing

Quote from: 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.
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?
Life doesn't have to be perfect to be wonderful ...

@rjen

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

Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

dougiefresh

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

GL700Wing

V5.3 - April 30th, 2018
o Per @rjen - 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 : Thanks for the updated Dutch language files - two new text strings have been added to AutoRotation.dutch.php/AutoRotation.dutch-utf8.php.
Life doesn't have to be perfect to be wonderful ...

@rjen

Quote from: GL700Wing on April 30, 2018, 05:23:27 AM
@rjen : 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...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

-Rock Lee-

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!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

GL700Wing

Quote from: 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?
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.

QuoteI 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 for the great mods he has developed and for allowing me to work on this mod.
Life doesn't have to be perfect to be wonderful ...

GL700Wing

V5.4 - May 1st, 2018
o Per @rjen - updated Dutch language files.
o Per Rock Lee - 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 : Thanks for the updated Dutch language files.
Rock Lee : Thanks for the feedback.
Life doesn't have to be perfect to be wonderful ...

-Rock Lee-

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!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Rob Lightbody

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


Tonyvic

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
QuoteNOTE: 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?

Rob Lightbody

Thanks. My mistake!  Yes it seems happier now...

GL700Wing

V5.5 - May 7th, 2018
o Per Rock Lee - updated/added Spanish langage files.
o Per The QE2 Story Forum and Tonyvic - 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 : Thanks for updated/new Spanish language files.
Life doesn't have to be perfect to be wonderful ...

Rob Lightbody

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.


GL700Wing

Quote from: 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.
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.
Life doesn't have to be perfect to be wonderful ...

Rob Lightbody

Quote from: GL700Wing on May 15, 2018, 06:44:11 AM
Quote from: 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.
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)..

Rob Lightbody

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

Advertisement: